Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku python datetime not includes fromisoformat

I run the following code on Heroku using the console:

~ $ python
Python 3.6.6 (default, Aug  1 2018, 21:10:15)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.fromisoformat("2015-06-06T17:23:54+10:00")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'
>>>

This works perfectly well on my Mac under Python 3.7.0.

How do I access 'fromisoformat' running under Heroku?

like image 755
Mark Schulz Avatar asked Nov 22 '18 23:11

Mark Schulz


1 Answers

Stupid me. 'fromisofomat' only appeared with Python3.7.0. heroku default is Python3.6.6. Added a runtime.txt with python-3.7.0 and everything now works.

Hope this helps someone else.

like image 181
Mark Schulz Avatar answered Sep 24 '22 04:09

Mark Schulz