Skip to content

Include module name on ImportError #55565

Closed

Description

@ncoghlan
BPO 11356
Nosy @birkenfeld, @ncoghlan, @cool-RR
Superseder
  • bpo-1559549: ImportError needs attributes for module and file name
  • 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 2011-03-01.06:35:45.408>
    created_at = <Date 2011-02-28.22:30:43.852>
    labels = ['interpreter-core', 'type-feature']
    title = 'Include module name on ImportError'
    updated_at = <Date 2011-03-01.06:35:45.406>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2011-03-01.06:35:45.406>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-03-01.06:35:45.408>
    closer = 'georg.brandl'
    components = ['Interpreter Core']
    creation = <Date 2011-02-28.22:30:43.852>
    creator = 'ncoghlan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 11356
    keywords = []
    message_count = 2.0
    messages = ['129729', '129741']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'ncoghlan', 'cool-RR']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'needs patch'
    status = 'closed'
    superseder = '1559549'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue11356'
    versions = ['Python 3.3']

    Activity

    1. ncoghlan commented on Feb 28, 2011

      @ncoghlan
      ContributorAuthor

      Catching ImportError in order to switch to an alternate implementation can mask real failures in imported modules. Attaching the module name as an attribute would allow this to be handled correctly by doing something like:

      try:
      import simplejson
      except ImportError as err:
      if err.module_name != 'simplejson':
      raise
      <backup plan>

      See http://mail.python.org/pipermail/python-ideas/2011-February/009209.html

    2. birkenfeld commented on Mar 1, 2011

      @birkenfeld
      Member

      This is a dupe of bpo-1559549.

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions