Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Demo.py #174

Open
micksulley opened this issue Dec 21, 2023 · 4 comments
Open

Problem with Demo.py #174

micksulley opened this issue Dec 21, 2023 · 4 comments

Comments

@micksulley
Copy link

My code has started to fail again over the last few days. Running Ubuntu Server.I have installed v1.20 and rebooted.
If I run the demo.py script this is what I see -

$ python demo.py
Traceback (most recent call last):
  File "/home/mick/Documents/Programs/shares/yahoo/yahoofinancials-master20231221/demo.py", line 18, in <module>
    from yahoofinancials import YahooFinancials as YF
  File "/home/mick/Documents/Programs/shares/yahoo/yahoofinancials-master20231221/yahoofinancials/__init__.py", line 1, in <module>
    from yahoofinancials.yf import YahooFinancials
  File "/home/mick/Documents/Programs/shares/yahoo/yahoofinancials-master20231221/yahoofinancials/yf.py", line 45, in <module>
    from yahoofinancials.data import YahooFinanceData
  File "/home/mick/Documents/Programs/shares/yahoo/yahoofinancials-master20231221/yahoofinancials/data.py", line 12, in <module>
    from yahoofinancials.sessions import SessionManager, _init_session
  File "/home/mick/Documents/Programs/shares/yahoo/yahoofinancials-master20231221/yahoofinancials/sessions.py", line 11, in <module>
    from frozendict import frozendict
ModuleNotFoundError: No module named 'frozendict'

Have I got something wrong or have Yahoo changed things again and I need to wait for an update?
Thanks
Mick

@JECSand
Copy link
Owner

JECSand commented Dec 22, 2023

@micksulley It seems as if you are are missing some of the new dependencies. Did you install via pip? If not could you try running (from the root directory):

python setup.py install

@micksulley
Copy link
Author

I think I am doing something wrong here.
I uninstalled and installed again with pip install yahoofinancials
I then ran setup.py and this is what I get

mick@holly:~/.local/lib/python3.10/site-packages/yahoofinancials$ sudo python setup.py install
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing yahoofinancials.egg-info/PKG-INFO
writing dependency_links to yahoofinancials.egg-info/dependency_links.txt
writing requirements to yahoofinancials.egg-info/requires.txt
writing top-level names to yahoofinancials.egg-info/top_level.txt
error: package directory 'yahoofinancials' does not exist

@JECSand
Copy link
Owner

JECSand commented Dec 29, 2023

@micksulley Did you ever resolve this? You shouldn't need to run setup.py if installing via pip.

@micksulley
Copy link
Author

I did reply via email, here it is again.
No I didn't resolve it. I dropped it over the holiday but just tried again. I re-installed and ran test_yahoofinancials.py downloaded from the website.

It doesn't fail, but it doesn't finish either. It has been running for 2-3 hours so far.

I get loads of warning messages, e.g

ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.10/queue.py:133: ResourceWarning: unclosed <ssl.SSLSocket fd=13, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 33920), raddr=('34.255.244.78', 443)>
with self.not_full:
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py:208: ResourceWarning: unclosed <ssl.SSLSocket fd=17, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 53568), raddr=('87.248.114.12', 443)>

session, crumb = _init_session(None, proxies=self._get_proxy(), timeout=self.timeout)

ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.10/ssl.py:1184: ResourceWarning: unclosed <ssl.SSLSocket fd=19, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 59874), raddr=('54.77.196.184', 443)>
return self._sslobj.getpeercert(binary_form)

There are loads of messages like that. My server is 192.168.1.99. Running Ubuntu Server 22.04.3 LTS (GNU/Linux 5.15.0-91-generic x86_64)

I left it running and it did eventually finish with an error after 4 hrs plus. This is the end of the output -

ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py:208: ResourceWarning: unclosed <ssl.SSLSocket fd=31, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 39956), raddr=('87.248.114.11', 443)>
session, crumb = _init_session(None, proxies=self._get_proxy(), timeout=self.timeout)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py:208: ResourceWarning: unclosed <ssl.SSLSocket fd=33, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 51130), raddr=('54.77.196.184', 443)>
session, crumb = _init_session(None, proxies=self._get_proxy(), timeout=self.timeout)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py:208: ResourceWarning: unclosed <ssl.SSLSocket fd=38, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 51138), raddr=('54.77.196.184', 443)>
session, crumb = _init_session(None, proxies=self._get_proxy(), timeout=self.timeout)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py:208: ResourceWarning: unclosed <ssl.SSLSocket fd=41, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 36836), raddr=('87.248.114.12', 443)>
session, crumb = _init_session(None, proxies=self._get_proxy(), timeout=self.timeout)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py:208: ResourceWarning: unclosed <ssl.SSLSocket fd=43, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.99', 39958), raddr=('87.248.114.11', 443)>
session, crumb = _init_session(None, proxies=self._get_proxy(), timeout=self.timeout)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
E

ERROR: test_yf_module_methods (main.TestModule)

Traceback (most recent call last):
File "/home/mick/v07_0/test_yahoofinancials.py", line 141, in test_yf_module_methods
out = self.test_yf_stock_single.get_ten_day_avg_daily_volume()
File "/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/yf.py", line 249, in get_ten_day_avg_daily_volume
return self._stock_summary_data('averageDailyVolume10Day')
File "/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/yf.py", line 183, in _stock_summary_data
sum_data = self.get_summary_data()
File "/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/yf.py", line 136, in get_summary_data
return self.get_clean_data(self.get_stock_tech_data('summaryDetail'), 'summaryDetail')
File "/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py", line 660, in get_stock_tech_data
return self.get_stock_data(tech_type=tech_type)
File "/home/mick/.local/lib/python3.10/site-packages/yahoofinancials/data.py", line 631, in get_stock_data
data.update(dict_ent)
TypeError: 'NoneType' object is not iterable


Ran 7 tests in 15978.086s

FAILED (errors=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants