TAGS :Viewed: 5 - Published at: a few seconds ago

[ Error with Crunchbase API wrapper pycrunchbase ]

I tried importing the pycrunchbase api wrapper and i get the following error.

It is a API wrapper that use the Crunchbase API platform

Doc: https://pycrunchbase.readthedocs.org/en/latest/usage.html

Github: https://github.com/ngzhian/pycrunchbase

>>> from pycrunchbase import *

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    from pycrunchbase import *
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/__init__.py", line 1, in <module>
    from .pycrunchbase import (
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/pycrunchbase.py", line 4, in <module>
    from .resource import (
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/__init__.py", line 1, in <module>
    from .acquisition import Acquisition
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/acquisition.py", line 3, in <module>
    from .node import Node
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/node.py", line 3, in <module>
    from .relationship import NoneRelationshipSingleton, Relationship
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/relationship.py", line 3, in <module>
    from .page import Page
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/page.py", line 4, in <module>
    from .pageitem import PageItem
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/pageitem.py", line 58, in <module>
    @six.python_2_unicode_compatible
AttributeError: 'module' object has no attribute 'python_2_unicode_compatible'

Answer 1


This is likely because your OS X is referencing an older version of six, that is not in your pip installed directory.

Pip installs in /Library/[..] while your system python installs in /System/Library/[..]

If you pip install six, it probably installs 1.9.0, but when you go into your python console, and type
>>> import six
>>> six.__version__
'1.4.1'
You'll probably get the above.

There's two options...the first and easiest is to just implement a virtualenv.

The second is to go to /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python and $ rm six.py six.pyc This will then force your console to reference your pip directory as opposed to your python dir, and the proper version will be referenced.

Hope that makes sense.

Answer 2


The pycrunchbase module has dependencies on the six and requests modules.

To get pycrunchbase working:

pip install requests six

And then you should be all set!