rstrip error python2.4.3 not in 2.5.1?

Philipp Pagel pDOTpagel at helmholtz-muenchen.de
Fri Feb 29 04:41:29 EST 2008


dirkheld <dirkheld at gmail.com> wrote:

> Here it is : I tought that I didn't matter because the deliciousapi
> worked fine on my mac.

> Traceback (most recent call last):
>   File "delgraph.py", line 62, in ?
>     url_metadata = d.get_url(site.rstrip())
>   File "deliciousapi.py", line 269, in get_url
>     document.bookmarks =
> self._extract_bookmarks_from_url_history(data)
>   File "deliciousapi.py", line 297, in
> _extract_bookmarks_from_url_history
>     timestamp = datetime.datetime.strptime(month_string, '%b ‘
> %y')
> AttributeError: type object 'datetime.datetime' has no attribute
> 'strptime'

The answer is right there: datetime.datetime has method strptime in
python 2.5 but which was not available in 2.4. A quick look into the
library reference confirms this:

----------------------------------------------------------------------
strptime(  	date_string, format)
	Return a datetime corresponding to date_string, parsed according to format.
    This is equivalent to datetime(*(time.strptime(date_string, format)[0:6])).
    ValueError is raised if the date_string and format can't be parsed by
    time.strptime() or if it returns a value which isn't a time tuple.

    New in version 2.5. 
----------------------------------------------------------------------

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl f. Genomorientierte Bioinformatik
Technische Universität München
http://mips.gsf.de/staff/pagel



More information about the Python-list mailing list