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

IOError has no __unicode__ method - and loses information #51139

Closed
voidspace opened this issue Sep 11, 2009 · 3 comments
Closed

IOError has no __unicode__ method - and loses information #51139

voidspace opened this issue Sep 11, 2009 · 3 comments
Labels

Comments

@voidspace
Copy link
Contributor

BPO 6890
Nosy @birkenfeld, @benjaminp, @voidspace
Superseder
  • bpo-6108: unicode(exception) and str(exception) should return the same message on Py2.6
  • 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 = None
    closed_at = <Date 2009-09-16.19:59:17.087>
    created_at = <Date 2009-09-11.20:50:43.426>
    labels = ['expert-IO']
    title = 'IOError has no __unicode__ method - and loses information'
    updated_at = <Date 2009-09-16.19:59:17.079>
    user = 'https://github.com/voidspace'

    bugs.python.org fields:

    activity = <Date 2009-09-16.19:59:17.079>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-09-16.19:59:17.087>
    closer = 'georg.brandl'
    components = ['IO']
    creation = <Date 2009-09-11.20:50:43.426>
    creator = 'michael.foord'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 6890
    keywords = ['26backport']
    message_count = 3.0
    messages = ['92525', '92528', '92713']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'benjamin.peterson', 'michael.foord']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '6108'
    type = None
    url = 'https://bugs.python.org/issue6890'
    versions = ['Python 2.6', 'Python 2.7']

    @voidspace
    Copy link
    Contributor Author

    >>> try:
    ...  open('flooble')
    ... except Exception as e:
    ...  pass
    ... 
    [39343 refs]
    >>> str(e)
    "[Errno 2] No such file or directory: 'flooble'"
    [39345 refs]
    >>> unicode(e)
    u"(2, 'No such file or directory')"

    The Unicode representation of an IOError has no information about the
    file or directory name. This is a regression from 2.5. Would be nice to
    backport a fix to 2.6 if we can.

    This bit docutils - and can happen as a side-effect of interpolating
    into a Unicode string with %s. The filename information is lost from the
    error report.

    @benjaminp
    Copy link
    Contributor

    If your curious, this is the bug report that broke it:
    http://bugs.python.org/issue2517

    @birkenfeld
    Copy link
    Member

    And this is a duplicate of (the somewhat complicated-named) bpo-6108.

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants