Benny- / Yahoo-ticker-symbol-downloader

A web scraper for ticker symbols from yahoo finance
https://pypi.python.org/pypi/Yahoo-ticker-downloader/
Other
247 stars 87 forks source link

Parse error when parsing stocks.pickle file #16

Closed ajrulez closed 7 years ago

ajrulez commented 8 years ago

Hi, first of all thanks for this utility. It is pretty damn useful and easy to use. I am getting a parse error when generating CSV file from the PICKLE file. Please see the logs below.

Logs:

Checking if we can resume a old download session Downloader found on disk, resuming The downloader has already finished downloading everything

Exporting Stock symbols Traceback (most recent call last): File "/usr/local/bin/YahooTickerDownloader.py", line 5, in pkg_resources.run_script('Yahoo-ticker-downloader==0.8.1', 'YahooTickerDownloader.py') File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 492, in run_script self.require(requires)[0].run_script(script_name, ns) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1357, in runscript exec(script_code, namespace, namespace) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkgresources.py", line 47, in exec exec("""exec code in globs, locs""") File "", line 1, in File "/Library/Python/2.7/site-packages/Yahoo_ticker_downloader-0.8.1-py2.7.egg/EGG-INFO/scripts/YahooTickerDownloader.py", line 147, in

File "/Library/Python/2.7/site-packages/Yahoo_ticker_downloader-0.8.1-py2.7.egg/EGG-INFO/scripts/YahooTickerDownloader.py", line 135, in main

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3593: ordinal not in range(128) xxx-MacBook-Pro:Yahoo-ticker-symbol-downloader-master xxx$

Please let me know if you need any other information.

Benny- commented 8 years ago

Curious problem. Have you tried removing the pickle file and trying again?

Benny- commented 8 years ago

This bug is reproducible on my machine.

Benny- commented 7 years ago

It works when using python3. I am considering dropping python2 support, I can't figure the error out.

Benny- commented 7 years ago

Can @simprince come inside and explain why it does not work in python2

Benny- commented 7 years ago

This is a problem with the tablib library I am using. You can track the progress on kennethreitz/tablib/issues/215.

Benny- commented 7 years ago

Basically it comes down to this: The tablib library is outputting binary strings instead of Unicode objects.

Benny- commented 7 years ago

A bit more specific: tablib is outputting binary string while running under python2 and Unicode like object under python3.

Benny- commented 7 years ago

A untested temporary solution is now available in master. Checkout https://github.com/Benny-/Yahoo-ticker-symbol-downloader/commit/9388dfd070aa66d9a08eb35106024965f2237636 If you have this problem.

Benny- commented 7 years ago

The untested solution has a bug. This will be fixed soonish. Probably next weekend.