1

raven附带了自己的模块版本,这似乎阻止我导入存在于独立六模块中的模块。请看下面:

Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> 
>>> from raven.utils import six       
>>> dir(six.moves)
['__doc__', '__name__']
>>> 
>>> 
>>> import six
>>> six.__version__
'1.9.0'
>>> 
>>> 
>>> 
>>> dir(six.moves)
['BaseHTTPServer', 'CGIHTTPServer', 'SimpleHTTPServer', 'StringIO', 'UserDict', 'UserList', 'UserString', '__doc__', '__name__', '_dummy_thread', '_thread', 'builtins', 'cPickle', 'cStringIO', 'configparser', 'copyreg', 'dbm_gnu', 'email_mime_base', 'email_mime_multipart', 'email_mime_nonmultipart', 'email_mime_text', 'filter', 'filterfalse', 'html_entities', 'html_parser', 'http_client', 'http_cookiejar', 'http_cookies', 'input', 'intern', 'map', 'queue', 'range', 'reduce', 'reload_module', 'reprlib', 'shlex_quote', 'socketserver', 'tkinter', 'tkinter_colorchooser', 'tkinter_commondialog', 'tkinter_constants', 'tkinter_dialog', 'tkinter_dnd', 'tkinter_filedialog', 'tkinter_font', 'tkinter_messagebox', 'tkinter_scrolledtext', 'tkinter_simpledialog', 'tkinter_tix', 'tkinter_tkfiledialog', 'tkinter_tksimpledialog', 'tkinter_ttk', 'urllib', 'urllib_error', 'urllib_parse', 'urllib_robotparser', 'winreg', 'xmlrpc_client', 'xmlrpc_server', 'xrange', 'zip', 'zip_longest']
>>> 
>>> 
>>> 
>>> 
>>> import six.moves.urllib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named urllib
>>> 
>>> 
>>> 

要重现这一点,请requests==0.14.1在您的虚拟环境中安装motoraven运行以下脚本:

from raven.utils import six as six1
from moto import mock_s3

任何提示将不胜感激。

4

2 回答 2

1

我收到了 Sentry Support 的回复并使用他们的提示,我发现如果您安装 requests-0.14.2(我已经安装),这个错误很容易出现。我升级请求,它不再发生。

相关链接:GitHub 上的 Moto 问题

于 2016-01-12T22:42:05.173 回答
0

因为这个问题似乎很难重现,所以它可能更适合我们的支持电子邮件——support@getsentry.com——而不是 StackOverflow。请在那里询问,我们会尽力提供帮助。

于 2016-01-09T18:27:54.377 回答