ttkbootstrap
ttkbootstrap copied to clipboard
Apparent namespace collision with the datetime package
Desktop (please complete the following information):
ttkbootstrap version: 1.10.1 OS: Linux Mint
Describe the bug
Some functions of the datetime package breaks after the import of ttkbootstrap.
To Reproduce
[~]$ python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime('8:0 PM', "%I:%M %p")
datetime.datetime(1900, 1, 1, 20, 0)
>>> import ttkbootstrap
>>> datetime.datetime.strptime('8:0 PM', "%I:%M %p")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/lib/python3.10/_strptime.py", line 352, in _strptime
raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: PM
Expected behavior
[~]$ python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime('8:0 PM', "%I:%M %p")
datetime.datetime(1900, 1, 1, 20, 0)
>>> import ttkbootstrap
>>> datetime.datetime.strptime('8:0 PM', "%I:%M %p")
datetime.datetime(1900, 1, 1, 20, 0)
Screenshots
No response
Additional context
No response
Not surprisingly, the time.strptime()
method breaks just as well.
I had the same problem
I know it's been a while since this issue was posted, but if you're still having difficulties, you can take a look at my suggestion in another issue on the same topic. I hope it helps! :smile:
@ismaelink Your workaround does the trick indeed. Thanks! 😄