I have a script with the following import:
from datetime import datetime
and a piece of code where I call:
datetime.fromisoformat(duedate)
Sadly, when I run the script with an instance of Python 3.6, the console returns the following error:
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'
I tried to run it from two instances of anaconda (3.7 and 3.8) and it works nice and smooth. I supposed there was an import problem so I tried to copy datetime.py from anaconda/Lib to the script directory, with no success.
The datetime.py
clearly contains the class datetime
and the method fromisoformat
but still it seems unlinked. I even tried to explicitly link the datetime.py
file, with the same error:
parent_dir = os.path.abspath(os.path.dirname(__file__))
vendor_dir = os.path.join(parent_dir, 'libs')
sys.path.append(vendor_dir+os.path.sep+"datetime.py")
Can you help me? My ideas are over...