I am trying to run the investopedia api located here: https://github.com/kirkthaker/investopedia-trading-api
I wrote the following script:
from investopedia import *
client = Account("emailaddress","password")
status = client.get_portfolio_status()
print status.account_val
print status.buying_power
print status.cash
print status.annual_return
I was able to install all the modules by running py -2.7 setup.py install
for each dependency.
I am receiving the following error:
Traceback (most recent call last):
File "C:/Users/Z/PycharmProjects/investopedia/test.py", line 1, in <module>
from investopedia import *
File "C:\Users\Z\PycharmProjects\investopedia\investopedia.py", line 4, in <module>
from bs4 import BeautifulSoup
File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\__init__.py", line 29, in <module>
from .builder import builder_registry
File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\builder\__init__.py", line 297, in <module>
from . import _html5lib
File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\builder\_html5lib.py", line 57, in <module>
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'
Do you know how to resolve this?
The Python "AttributeError: 'list' object has no attribute" occurs when we access an attribute that doesn't exist on a list. To solve the error, access the list element at a specific index or correct the assignment.
To solve the Python "AttributeError: module has no attribute", make sure you haven't named your local modules with names of remote modules, e.g. datetime.py or requests.py and remove any circular dependencies in import statements.
What does it mean when a module has no attribute? It's simply because there is no attribute with the name you called, for that Object. This means that you got the error when the "module" does not contain the method you are calling.
If you are getting an object that has no attribute error then the reason behind it is because your indentation is goofed, and you've mixed tabs and spaces. Run the script with python -tt to verify.
Solved this by using
pip2.7 install --upgrade beautifulsoup4
pip2.7 install --upgrade html5lib
Works beautifully now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With