Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE RPC Proxy for standard IO streams lacks 'errors' attribute #57176

Closed
Benthelen mannequin opened this issue Sep 13, 2011 · 17 comments
Closed

IDLE RPC Proxy for standard IO streams lacks 'errors' attribute #57176

Benthelen mannequin opened this issue Sep 13, 2011 · 17 comments
Assignees
Labels
topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@Benthelen
Copy link
Mannequin

Benthelen mannequin commented Sep 13, 2011

BPO 12967
Nosy @terryjreedy, @ned-deily, @ezio-melotti, @serwy, @takluyver, @serhiy-storchaka
Superseder
  • bpo-9290: IDLE and Command line present different behavior for sys.stdin
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = <Date 2012-11-17.17:19:11.494>
    created_at = <Date 2011-09-13.04:38:10.330>
    labels = ['expert-IDLE', 'type-bug']
    title = "IDLE RPC Proxy for standard IO streams lacks 'errors' attribute"
    updated_at = <Date 2012-11-17.17:19:22.784>
    user = 'https://bugs.python.org/Benthelen'

    bugs.python.org fields:

    activity = <Date 2012-11-17.17:19:22.784>
    actor = 'terry.reedy'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2012-11-17.17:19:11.494>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2011-09-13.04:38:10.330>
    creator = 'Ben.thelen'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 12967
    keywords = []
    message_count = 17.0
    messages = ['143949', '143963', '144002', '144081', '144114', '144158', '144187', '144190', '145204', '145215', '145565', '164623', '165193', '172596', '175733', '175777', '175781']
    nosy_count = 8.0
    nosy_names = ['terry.reedy', 'ned.deily', 'ezio.melotti', 'roger.serwy', 'v+python', 'takluyver', 'Ben.thelen', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '9290'
    type = 'behavior'
    url = 'https://bugs.python.org/issue12967'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    @Benthelen
    Copy link
    Mannequin Author

    Benthelen mannequin commented Sep 13, 2011

    AttributeErrors on log.py in the distutils directory

    import sys
    stream = sys.stdout
    if stream.errors == 'strict': pass'=> this will raise an AttributeError'

    @Benthelen Benthelen mannequin assigned tarekziade Sep 13, 2011
    @Benthelen Benthelen mannequin added build The build process and cross-build stdlib Python modules in the Lib dir labels Sep 13, 2011
    @merwok
    Copy link
    Member

    merwok commented Sep 13, 2011

    When will it raise an AttributeError?

    @Benthelen
    Copy link
    Mannequin Author

    Benthelen mannequin commented Sep 14, 2011

    Error had been raised when installing the distribute package, but it could be raised on any other usage as sys.stdout does not have an 'error' attribute.
     
     

    From: Éric Araujo <report@bugs.python.org>
    To: thelen_ben@yahoo.com
    Sent: Tuesday, 13 September 2011 8:54 PM
    Subject: [bpo-12967] AttributeError distutils\log.py

    Éric Araujo <merwok@netwok.org> added the comment:

    When will it raise an AttributeError?

    ----------


    Python tracker <report@bugs.python.org>
    <http://bugs.python.org/issue12967\>


    @merwok
    Copy link
    Member

    merwok commented Sep 15, 2011

    when installing the distribute package
    How? Please tell exactly what command you ran with what Python version.

    it could be raised on any other usage as sys.stdout does not have
    an 'error' attribute.
    It does, in 3.x. Do you think Python has no tests or no users? :)

    @merwok merwok assigned merwok and unassigned tarekziade Sep 15, 2011
    @Benthelen
    Copy link
    Mannequin Author

    Benthelen mannequin commented Sep 16, 2011

    Hi Eric,
     
    I'm not suggesting that python does not test the applications. just reporting what I experience.
    The python version installed is r32:88445
     
    What I did, I opened the setup file (in IDLE) from the distribute 0.6.21 and run this.
     
    On my python 3.2 version (clean without extentions). when I type in (on the command line)
     

    >>import sys
    >>sys.stdout.error
    'strict'
     
    However on the IDLE when I do the same.
    a AttributeError is being raised.
     
    Not sure why the difference between the two (I thought these were the same).
     
    Ben

    From: Éric Araujo <report@bugs.python.org>
    To: thelen_ben@yahoo.com
    Sent: Thursday, 15 September 2011 10:54 PM
    Subject: [bpo-12967] AttributeError distutils\log.py

    Éric Araujo <merwok@netwok.org> added the comment:

    How?  Please tell exactly what command you ran with what Python version.

    It does, in 3.x.  Do you think Python has no tests or no users? :)

    ----------
    assignee: tarek -> eric.araujo


    Python tracker <report@bugs.python.org>
    <http://bugs.python.org/issue12967\>


    @ned-deily
    Copy link
    Member

    That won't work in IDLE because IDLE replaces the standard sys.stdout file object with a special proxy object to capture stdout across its processes and the proxy object does not currently support all of the attributes of a io.TextTIOWrapper object, like errors.

    >>> sys.stdout
    <idlelib.rpc.RPCProxy object at 0x1282b30>

    If that is the only problem, perhaps this issue should be reassigned to IDLE to support errors and any other relevant new attributes.

    @Benthelen
    Copy link
    Mannequin Author

    Benthelen mannequin commented Sep 17, 2011

    Hi Ned,
     
    Not sure if I fully understand the IDLE issue, I'm still learning Python (abt. 6 months). Nevertheless I've installed the distributes through the command line.
     
    if you want to reassign this issue to IDLE, please do so.
     
    Best regards,
     
    Ben Thelen
     
     

    From: Ned Deily <report@bugs.python.org>
    To: thelen_ben@yahoo.com
    Sent: Saturday, 17 September 2011 4:43 AM
    Subject: [bpo-12967] AttributeError distutils\log.py

    Ned Deily <nad@acm.org> added the comment:

    That won't work in IDLE because IDLE replaces the standard sys.stdout file object with a special proxy object to capture stdout across its processes and the proxy object does not currently support all of the attributes of a io.TextTIOWrapper object, like errors.

    <idlelib.rpc.RPCProxy object at 0x1282b30>

    If that is the only problem, perhaps this issue should be reassigned to IDLE to support errors and any other relevant new attributes.

    ----------
    nosy: +ned.deily


    Python tracker <report@bugs.python.org>
    <http://bugs.python.org/issue12967\>


    @merwok
    Copy link
    Member

    merwok commented Sep 17, 2011

    I'm not suggesting that python does not test the applications. just reporting
    what I experience.
    I was joking :) What I meant was: I can’t agree with the statement “it could be raised on any other usage as sys.stdout does not have an 'error' attribute” because we have tests and users that use distutils without seeing this error.

    What I did, I opened the setup file (in IDLE) from the distribute 0.6.21 and run this.
    setup.py is meant to be run from the command line only. If you try to run it from IDLE, the behavior is undefined, so I’m inclined to close this bug as invalid.

    (A note about this bug tracker: please do not send HTML email, it gets transformed into an unhelpful attachment, and also don’t include whole messages after your reply when you send email. Thanks in advance!)

    @merwok
    Copy link
    Member

    merwok commented Oct 9, 2011

    I stand by my opinion that running setup.py from IDLE is not supported.

    @merwok merwok closed this as completed Oct 9, 2011
    @merwok merwok added type-bug An unexpected behavior, bug, or error and removed build The build process and cross-build labels Oct 9, 2011
    @ned-deily
    Copy link
    Member

    I don't have a strong opinion about whether running setup.py in IDLE is supported. But that's not the real issue here. The problem is that the IDLE RPC proxy of the standard IO streams is incomplete, in particular, the 'errors' attribute of io.TextIOWrapper streams. Looking back, it appears that the errors attribute was added to file objects and io streams in 2.6 but support for that was not added to IDLE. I think that should be fixed.

    @ned-deily ned-deily added topic-IDLE and removed stdlib Python modules in the Lib dir labels Oct 9, 2011
    @ned-deily ned-deily reopened this Oct 9, 2011
    @ned-deily ned-deily changed the title AttributeError distutils\log.py IDLE RPC Proxy for standard IO streams lacks 'errors' attribute Oct 9, 2011
    @ned-deily ned-deily assigned ned-deily and unassigned merwok Oct 9, 2011
    @terryjreedy
    Copy link
    Member

    Thank you for redirecting this issue. The goal should be to make the proxies completely transparent. They mostly are, but occasional issues arise when they are not. Sometimes the source of a problem is not clear. I wonder, for instance, whether the non-function in IDLE of

    >>> print(input())
    abc\
    abc\

    has anything to do with the bidirectional communication or is entirely internal to IDLE.

    @vpython
    Copy link
    Mannequin

    vpython mannequin commented Jul 3, 2012

    So this looks like it might be a simple fix... in bpo-1602, there was a patch for Windows console for 3.1... sadly not applied then, or 3.2, or 3.3 (yet). But in 3.2, the fix sprouted a failure just like this one: the console output class would get reported to not have an "errors" attribute when doing an input. A fix there was to add an attribute errors='strict' to the console output class.

    Here it seems the same symptom sprouted in the same time frame, for a similar situation where the output class has been replaced by one that doesn't have an errors attribute... so it should grow one...

    @serwy
    Copy link
    Mannequin

    serwy mannequin commented Jul 10, 2012

    bpo-13532 has an applied patch (422242dbce30) for the subprocess that makes the stdout, stderr, and stdin inherit from io.TextIOBase. This includes the "errors" attribute, albeit set to ''.

    The fix does not apply when running IDLE without a subprocess, so the .errors attribute will still be missing.

    @serhiy-storchaka
    Copy link
    Member

    If this issue only about 'errors' attribute of IDLE RPC Proxy for standard IO streams, then it should be closed as outdated. If this issue about 'errors' attribute of IDLE standard IO streams (even when running IDLE without a subprocess), then the patches for bpo-9290 will solve this issue.

    @takluyver
    Copy link
    Mannequin

    takluyver mannequin commented Nov 17, 2012

    It seems pretty arbitrary and newcomer-unfriendly to decide that Python doesn't support running setup.py inside IDLE.

    Exhibit A: confused newcomer trying to install distribute, getting unhelpful error message.
    http://stackoverflow.com/questions/13368040/ipython-installation-on-3-3-x64-errors

    @terryjreedy
    Copy link
    Member

    Thomas, please re-read the messages starting msg145215 where it was decided that this is not an issue about setup.py in particular. There appears to now only be a problem if IDLE is run without a subprocess, and that option may disappear in 3.4 as unneeded.

    @terryjreedy
    Copy link
    Member

    Even though the title of bpo-9290 says stdin, the patches are for all std** streams, so should cover this.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants