[cx-oracle-users] no module name datetime in python 1.5.2 while cx_Oracle in python 2.7.1 is return
Brought to you by:
atuining
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-10 09:02:43
|
Hello guys, Something new I discovered in migrating my application from python 1.5.2 to 2.7.1, from oracledb to cx_Oracle. I noticed that data with date as the column type, is returned from a SQL query wrapped with datetime.datetime(). This has caused my clients which in a lower version of python unable to parse it. While converting my client to python 2.7.1 may solve the problem, I have a constraint of keeping the client at python 1.5.2 at the moment. Is there a way to "switch off" the prefix or the wrapper from the application server where the python version is higher? I will definitely work on migrating client to 2.7.1 as well however I must go through the stage of keeping client at 1.5.2 for a while before converting. Hope to hear some solution out here. Python 1.5.2 >>> a.execute("select USER_ENTER_DATE, USER_MODIFY_DATE, USER_LAST_PW_CHANGE, USER_LAST_PW2_CHANGE, USER_LAST_PW3_CHANGE, USER_LAST_LOGIN_DATE, USER_STATUS_CHANGE_DATE from users where USER_ID='EC733'") Traceback (innermost last): File "<stdin>", line 1, in ? File "D:\genesis\Product\Lib\RMI.py", line 1765, in __call__ raise sys.exc_type, sys.exc_value ImportError: No module named datetime >>> Python 2.7.1 >>> d.execute("select USER_ENTER_DATE, USER_MODIFY_DATE, USER_LAST_PW_CHANGE, USER_LAST_PW2_CHANGE, USER_LAST_PW3_CHANGE, USER_LAST_LOGIN_DATE, USER_STATUS_CHANGE_DATE from users where USER_ID='EC733'") [(datetime.datetime(2000, 4, 24, 14, 30, 13), datetime.datetime(2010, 3, 6, 2, 42, 27), datetime.datetime(2011, 3, 2, 10, 19, 54), datetime.datetime(2011, 1, 7, 10, 18, 58), datetime.datetime(2010, 12, 8, 11, 5, 38), datetime.datetime(2011, 3, 2, 10, 30, 31), datetime.datetime(2011, 3, 2, 10, 30, 31))] Regards, Wah Meng |