date demo1 not working for me

Hi, I’m new to mpl and want to
learn date plotting. Would like to start with the demo, but date_demo1
won’t run for me. (My specs: winXP, Python 2.5, matplotlib 0.9.0,
numpy 1.0, and yes was connected to the internet when I ran it). I
just copied into IDLE and saved it and got this error:

Traceback (most recent call last):

File “C:/Documents and Settings/user/Desktop/datedemo.py”, line 22, in

quotes = quotes_historical_yahoo('INTC', date1, date2)

File “C:\Python25\lib\site-packages\matplotlib\finance.py”, line 153, in quotes_historical_yahoo

try: ret = parse_yahoo_historical(fh, asobject, adjusted)

File “C:\Python25\lib\site-packages\matplotlib\finance.py”, line 53, in parse_yahoo_historical

dt = datetime.date(*time.strptime(datestr, '%d-%b-%y')[:3])

File “C:\Python25\lib_strptime.py”, line 310, in strptime

(data_string, format))

ValueError: time data did not match format: data=2003-12-01 fmt=%d-%b-%y

Any idea what I’m doing wrong?

Thanks,

Che

Well, if data='2003-12-01', the format should be "%y-%m-%d" or "%y-%d-%m"
depending on the local convention. Here, 2003 is interpreted as a day, which
of course doesn't work.

···

On Tuesday 27 March 2007 16:27:35 C M wrote:

ValueError: time data did not match format: data=2003-12-01 fmt=%d-%b-%y

Any idea what I'm doing wrong?

C M wrote:

Hi, I'm new to mpl and want to learn date plotting. Would like to start with the demo, but date_demo1 won't run for me. (My specs: winXP, Python 2.5, matplotlib 0.9.0, numpy 1.0, and yes was connected to the internet when I ran it). I just copied into IDLE and saved it and got this error:

Traceback (most recent call last):
  File "C:/Documents and Settings/user/Desktop/datedemo.py", line 22, in <module>
    quotes = quotes_historical_yahoo('INTC', date1, date2)
  File "C:\Python25\lib\site-packages\matplotlib\finance.py", line 153, in quotes_historical_yahoo
    try: ret = parse_yahoo_historical(fh, asobject, adjusted)
  File "C:\Python25\lib\site-packages\matplotlib\finance.py", line 53, in parse_yahoo_historical
    dt = datetime.date(*time.strptime(datestr, '%d-%b-%y')[:3])
  File "C:\Python25\lib\_strptime.py", line 310, in strptime
    (data_string, format))
ValueError: time data did not match format: data=2003-12-01 fmt=%d-%b-%y

Any idea what I'm doing wrong?

You are not doing anything wrong. I noticed the bug recently also. I don't know when or why it started. It is not python 2.5-specific; I see it while running 2.4 and svn mpl.

Thanks for reporting it.

Eric

···

Thanks,
Che