This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bug in modulefinder: import_hook() got an unexpected keyword argument 'level'
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: andreas, r.david.murray
Priority: normal Keywords:

Created on 2010-03-09 10:27 by andreas, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
moduleFinderBug.py andreas, 2010-03-09 10:27 simple script to reproduce the bug
Messages (2)
msg100711 - (view) Author: Andreas Pfeiffer (andreas) Date: 2010-03-09 10:27
Hi,

  the attached file (moduleFinderBug.py) crashes in python 2.6 on
linux (RedHat EL 5) and Mac OS X (10.6) with the traceback below.

A possible fix for this would be in modulefinder.py:
323c323
<             self.import_hook(name, caller, level=level)
---
>             self.import_hook(name, caller=caller, level=level)

Please let me know if you need any further information.

Thanks,
   cheers, andreas



$> python moduleFinderBug.py
Traceback (most recent call last):
  File "work/cms/moduleFinderBug.py", line 17, in <module>
    modulefinder.run_script(filename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/modulefinder.py", line 114, in run_script
    self.load_module('__main__', fp, pathname, stuff)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/modulefinder.py", line 305, in load_module
    self.scan_code(co, m)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/modulefinder.py", line 414, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/modulefinder.py", line 323, in _safe_import_hook
    self.import_hook(name, caller, level=level)
TypeError: import_hook() got an unexpected keyword argument 'level'
msg100732 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-03-09 15:04
Unless I'm missing something, this appears to be a bug in your code.  You redefine import_hook in your subclass, but you don't give it a level parameter.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52344
2010-03-09 15:04:45r.david.murraysetstatus: open -> closed
priority: normal
type: crash -> behavior

components: + Library (Lib), - Extension Modules

nosy: + r.david.murray
messages: + msg100732
resolution: not a bug
stage: resolved
2010-03-09 10:27:37andreascreate