Reputation: 16926
I'm puzzled why this crashes. I can paste these two lines into a python shell and reliably get a segfault and be kicked out of the Python session:
from PyQt5.QtCore import QDate
QDate(2011, 1, 2).daysTo(QDate(2012, 1, 1))
Adding try/except won't catch anything.
Versions I'm using:
Python 3.10.6 (main, Aug 3 2022, 17:39:45) [GCC 12.1.1 20220730] on linux
from PyQt5.QtCore import QT_VERSION_STR
from PyQt5.Qt import PYQT_VERSION_STR
print(QT_VERSION_STR) # 5.15.4
print(PYQT_VERSION_STR) # 5.15.7
Upvotes: 0
Views: 78
Reputation: 16926
Solved! The script I'm running was named datetime.py in the directory. Bad idea, even if I'm only using the PyQt's date and time stuff. It's probably pulling in Python's datetime module behind the scenes.
Changing the name to "trydatetime.py" or "timedate.py" made the problem go away.
Upvotes: 0