I have two datetime objects, one from the database and one which I created with the datetime module. When I compare them it works fine on Windows but when I try it on my Fedora 3 I get this error:
exceptions.TypeError: can't compare datetime.datetime to DateTime
This must be a bug, but who's responsible for it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What versions of everything are you using? (Python, MySQL, MySQL-python)
It looks like you have mx.DateTime on your Fedora Core system.MySQLdb uses the Python datetime types (available in Python-2.3 and newer) when it finds them.
It would be possible to reconfigure MySQLdb to not use datetime, I suppose, or you could change your application to not use mx.DateTime.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I guess I will just use mx.DateTime. Will it change anything if I upgraed to MySQL-python 1.2? I was trying it earlier but I ran into this problem: (http://sourceforge.net/forum/forum.php?thread_id=1268634&forum_id=70461)
btw, sorry for posting in the wrong forum.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, it should still try to use the Python datetime objects first, in both 1.0 and 1.2, You may want to take a look at MySQLdb/*times.py and MySQLdb/converters.py to see how it picks the right type of datetime object, particularly times.py. If you change the import order, it should do what you want. I try to use native Python types whenever possible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have two datetime objects, one from the database and one which I created with the datetime module. When I compare them it works fine on Windows but when I try it on my Fedora 3 I get this error:
exceptions.TypeError: can't compare datetime.datetime to DateTime
This must be a bug, but who's responsible for it?
What versions of everything are you using? (Python, MySQL, MySQL-python)
It looks like you have mx.DateTime on your Fedora Core system.MySQLdb uses the Python datetime types (available in Python-2.3 and newer) when it finds them.
It would be possible to reconfigure MySQLdb to not use datetime, I suppose, or you could change your application to not use mx.DateTime.
Python 2.3.4
MySQL 3.23.58
MySQL-python 0.9.2
I guess I will just use mx.DateTime. Will it change anything if I upgraed to MySQL-python 1.2? I was trying it earlier but I ran into this problem: (http://sourceforge.net/forum/forum.php?thread_id=1268634&forum_id=70461)
btw, sorry for posting in the wrong forum.
No, it should still try to use the Python datetime objects first, in both 1.0 and 1.2, You may want to take a look at MySQLdb/*times.py and MySQLdb/converters.py to see how it picks the right type of datetime object, particularly times.py. If you change the import order, it should do what you want. I try to use native Python types whenever possible.