【发布时间】:2014-05-30 17:26:53
【问题描述】:
显然,导入 RichIPythonWidget 对模块 pkgutil 有影响。
测试环境:
IPython 版本:2.1.0 python版本:2.7 & 2.7.6
代码显示问题:
import os
import pkgutil
print 'Before 1 ... '
pkgutil.find_loader('os') # call 1
print 'After call 1 ... '
from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
print 'Before call 2 ... '
pkgutil.find_loader('os') # call 2
print 'After call 2 ... '
输出:
Before call 1 ...
After call 1 ...
Before call 2 ...
Traceback (most recent call last):
File "issue.py", line 11, in <module>
pkgutil.find_loader('os') # call 2
File "/u/bl/Dev/work/inkqt/opt.SuSE-11.4/lib64/python2.7/pkgutil.py", line 467, in find_loader
loader = importer.find_module(fullname)
TypeError: find_module() takes exactly 3 arguments (2 given)
据我了解,我的问题似乎与添加到 sys.meta_path 的对象有关 IPython 使用,但 pkgutil 模块使用了错误的接口。 但我很难确定谁是有罪的……
任何解决方法将不胜感激。
谢谢
-贝诺特
【问题讨论】:
标签: python python-2.7 ipython