yahoo-finance / yahoo-finance

Python module to get stock data from Yahoo! Finance
1.34k stars 354 forks source link

Error initializing with YHOO data #9

Closed rdiasfreitas closed 9 years ago

rdiasfreitas commented 9 years ago

I'm getting an error when using the API inside a Django application. It looks like an issue with datetime parsing, but I haven't figure it out yet.

(most recent call last):

File "/projects/projetos/xxxx/module/submodule.py", line 455, in getYahoo yahoo = Share('YHOO') File "/projects/projetos/xxxx/venv/lib/python2.7/site-packages/yahoo_finance/init.py", line 175, in init super(Share, self).init(symbol) File "/projects/projetos/xxxx/venv/lib/python2.7/site-packages/yahoo_finance/init.py", line 75, in init self.data_set = self._fetch() File "/projects/projetos/xxxx/venv/lib/python2.7/site-packages/yahoo_finance/init.py", line 180, in _fetch data[u'LastTradeDateTimeUTC'] = edt_to_utc('{0} {1}'.format(data['LastTradeDate'], data['LastTradeTime'])) File "/projects/projetos/xxxx/venv/lib/python2.7/site-packages/yahoo_finance/init.py", line 21, in edt_toutc date = datetime.strptime(date, mask) File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime data_string[found.end():]) ValueError: unconverted data remains: pm

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

rdiasfreitas commented 9 years ago

Solution: on edt_to_utc: locale.setlocale(locale.LC_ALL, "en_US.UTF-8") do things go back to default locale

lukaszbanasiak commented 9 years ago

@rdiasfreitas Are you interested in create a pull request

lukaszbanasiak commented 9 years ago

@rdiasfreitas I can not reproduce the error. Can you show more details?