0
Expensive,
I always worked with strptime without major problems, but a mistake started to appear that I did not find in any quote:
from datetime import datetime
a = "20160228"
date = datetime.strptime(a, "%Y%m%d")
This is just the example and the error that appears:
Traceback (most recent call last):
File "/home/bruno/PycharmProjects/Shiny/date.py", line 3, in <module>
date = datetime.strptime(a, '%Y%m%d')
File "/usr/lib/python2.7/_strptime.py", line 274, in <module>
_TimeRE_cache = TimeRE()
File "/usr/lib/python2.7/_strptime.py", line 192, in __init__
self.locale_time = LocaleTime()
File "/usr/lib/python2.7/_strptime.py", line 70, in __init__
self.lang = _getlang()
File "/usr/lib/python2.7/_strptime.py", line 29, in _getlang
return locale.getlocale(locale.LC_TIME)
AttributeError: 'module' object has no attribute 'getlocale'
I appreciate the help.
When did it start? Does it use Linux or Windows? Why does it still use Python 2 and not Python 3?
– Woss
Probably after updating Ubuntu 18.04, the scripts I work are always in 2.7, I also do with 3. But this error I found very strange.
– Bruno Maronezzi
This looks like some package not installed on Linux.
– Woss
That’s also what I was wondering, but I don’t know which package, I tried to reinstall several, but it doesn’t change.
– Bruno Maronezzi