Benny-/Yahoo-ticker-symbol-downloader

UnicodeEncodeError

Closed this issue · 9 comments

First of all, thank you so much for developing this great tool. There is simply no other tools that do it better and simpler. As I use it to download symbols, I notice that it sometimes yields errors such as

UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 30: ordinal not in range(128)

That leads me to another question: if I finish the first batch run of the downloader, meaning all queries are done once, can I simply run it again and hope that it can pick up those missing ones?

+1.
Same here when trying to download stock symbols. Version used is 0.5.1 as pip gives me that version.

Traceback (most recent call last):
  File "/usr/local/bin/YahooTickerDownloader.py", line 140, in <module>
    main()
  File "/usr/local/bin/YahooTickerDownloader.py", line 97, in main
    downloadEverything(downloader, tickerType, args.insecure)
  File "/usr/local/bin/YahooTickerDownloader.py", line 50, in downloadEverything
    print (" " + unicode(symbols[0]))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 30-31: ordinal not in range(128)

I go through the program and this line of code only means to output the message. So it is safe to remove it. Also, there is a similar encoding issue when you finally finish everything and export as csv/xml etc. Need to add encode() there to make it work.

That leads me to another question: if I finish the first batch run of the downloader, meaning all queries are done once, can I simply run it again and hope that it can pick up those missing ones?

No. Once it is done you will have to start over again.

I don't have a lot of time right now. So this bug might be open for a long time before I start solving it.

Could you tell me your operating system and python version? This might be related to bug #7

Python version is 2.7.9. OS is Debian GNU/LInux 8.2 (jessie)

Just for your info: The workaround mention in bug #7 (setting LANGUAGE and LC_ALL to en_US.UTF-8) worked for me.

@simprince Thanks, the solution is so obvious now

It will take a while for the package to be uploaded to PyPi

I have chosen UTF-8 as the default output char encoding