israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.99k stars 395 forks source link

Apparent namespace collision with the datetime package #443

Open Babber opened 1 year ago

Babber commented 1 year ago

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

Babber commented 1 year ago

Not surprisingly, the time.strptime() method breaks just as well.

yang-521 commented 1 year ago

I had the same problem

ismaelink commented 1 year ago

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:

Babber commented 1 year ago

@ismaelink Your workaround does the trick indeed. Thanks! 😄