[Tutor] Is it possible to "backport" the datetime module of Python 3.3 to Python 3.2?

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Apr 21 13:31:53 CEST 2015


On 20/04/2015 21:05, Albert-Jan Roskam wrote:
> Hi,
>
> My Raspberry Pi 2 comes with Python 3.2 (and 2.7). I run some code that uses the datetime module but I get an error:
>
> "AttributeError: 'datetime.datetime' object has no attribute 'timestamp'". On https://docs.python.org/3/whatsnew/3.3.html I see: "New datetime.datetime.timestamp() method: Return POSIX timestamp corresponding to thedatetime instance." Is upgrading Python 3.3 or higher my only option, or is it somehow possible to use the newer version of the datetime library for Python 3.2? I do not want to modify the source code of the library that causes the error (pysolar).
>
> Thanks!
>
>
> Regards,
>
> Albert-Jan
>
>

Python is very strong in guaranteeing backward compatibility, so why not 
copy the 3.3 pure Python code to your 3.2 setup and see what happens?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list