'datetime's strptime returns Value Error when using the Qt GUI module

I am trying to run a Jupyter notebook that uses the Qt GUI module. I just realized that this module prevents datetime's strptime from working properly.

The following snippet returns datetime.datetime(2000, 1, 1, 0, 0), just as expected:

from datetime import datetime
datetime.strptime('2000 Jan 01 00:00:0.000', '%Y %b %d %H:%M:%S.%f')

But calling the Qt GUI module before these two lines throws a 'does not match format error':

%gui qt
from datetime import datetime
datetime.strptime('2000 Jan 01 00:00:0.000', '%Y %b %d %H:%M:%S.%f')

This is the error message that I am getting:

ValueError: time data '2000 Jan 01 00:00:0.000' does not match format '%Y %b %d %H:%M:%S.%f'

Any idea how to circumvent this problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source