braintree/braintree_python

Can't import braintree

Closed this issue · 4 comments

$ pip install braintree
Collecting braintree
  Using cached braintree-3.38.0-py2.py3-none-any.whl
Collecting requests<3.0,>=0.11.1 (from braintree)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests<3.0,>=0.11.1->braintree)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests<3.0,>=0.11.1->braintree)
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests<3.0,>=0.11.1->braintree)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests<3.0,>=0.11.1->braintree)
  Using cached certifi-2017.7.27.1-py2.py3-none-any.whl
Installing collected packages: urllib3, idna, chardet, certifi, requests, braintree
Successfully installed braintree-3.38.0 certifi-2017.7.27.1 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
$ python 
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import braintree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "braintree.py", line 5, in <module>
    braintree.Configuration.configure(braintree.Environment.Sandbox,
AttributeError: 'module' object has no attribute 'Configuration'
>>> 

As you can see, braintree module version is 3.38. The system is Debian Linux 9 with Python 2.7

My guess is you named your file braintree.py, so when you do import braintree, it's importing your braintree.py file instead of the the installed library. Try renaming the file to something else, and you shouldn't get the error.

It is the case. Thanks.

Thanks dud,
crookedneighbor.

Thank u very much

its working by changing the name of file...