retrying icon indicating copy to clipboard operation
retrying copied to clipboard

python 2.7 & OS X / AttributeError: 'module' object has no attribute 'wraps'

Open marvin-zhao opened this issue 9 years ago • 4 comments

I have a weird question. It don't work at Mac OS X, but it can work at linux. My Macbook envs:

$ python -V
Python 2.7.6

retrying (1.3.3) six (1.9.0)

Error:

AttributeError at /
'module' object has no attribute 'wraps'
Request Method: GET
Request URL:    http://127.0.0.1:8080/
Django Version: 1.5.5
Exception Type: AttributeError
Exception Value:    
'module' object has no attribute 'wraps'
Exception Location: /Library/Python/2.7/site-packages/retrying.py in wrap, line 47
Python Executable:  /usr/bin/python
Python Version: 2.7.6
Python Path:    
['/Users/yangxufeng.zhao/workspace/work/xnetweb',
 '/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg',
 '/Library/Python/2.7/site-packages/paramiko-1.14.0-py2.7.egg',
 '/Library/Python/2.7/site-packages/ecdsa-0.11-py2.7.egg',
 '/Library/Python/2.7/site-packages/pycrypto-2.6.1-py2.7-macosx-10.9-intel.egg',
 '/Library/Python/2.7/site-packages/setuptools-5.4.1-py2.7.egg',
 '/Library/Python/2.7/site-packages/json2xml-0.6-py2.7.egg',
 '/Library/Python/2.7/site-packages/Routes-2.0-py2.7.egg',
 '/Library/Python/2.7/site-packages/repoze.lru-0.6-py2.7.egg',
 '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg',
 '/Library/Python/2.7/site-packages/oss-0.1.3-py2.7.egg',
 '/Users/yangxufeng.zhao/workspace/work/arch_define',
 '/Users/yangxufeng.zhao/workspace/work/xnetweb',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
 '/Library/Python/2.7/site-packages']

marvin-zhao avatar Mar 17 '15 07:03 marvin-zhao

I'm also with this issue when trying to deploy in ScrapingHub

tsouza avatar Aug 07 '15 14:08 tsouza

I'm seeing the exact same issue. Here's my version list...

OS X python (2.7.10) retrying (1.3.3) six (1.4.1)

Is this package abandoned?

corradomatt avatar Apr 08 '16 21:04 corradomatt

Today, I also met this error, after analysis I found the reason. The reason is:

  1. there have two different version module 'six' in my system: the one is six-1.4.0 other one is six-1.10.0.
  2. retrying need six>1.7.0.
  3. when you import six in your scripts, actually the six-1.4.0 been imported.

My solution is: rm /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.{py,pyc}

=============================================================== The detail info:

six-1.4.1, it's abs_path is : /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py

six-1.10.0, it's abs_path is: /Library/Python/2.7/site-packages/six.py

otherwise, the two directory are all in sys.path, and the directory six-1.4.0 in before of the directory six-1.10.0, so when you use import six, you actually import six-1.4.0.

mengalong@along-mac:/Library/Python/2.7/site-packages$ python Python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import sys for item in sys.path: ... print item ...

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC /Library/Python/2.7/site-packages

mengalong avatar Dec 19 '16 16:12 mengalong

nice digging, bro

lhjh19 avatar May 20 '19 00:05 lhjh19