[pywin32-bugs] [ pywin32-Bugs-3438213 ] astimezone could not process time on Pythonwin for 3.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: SourceForge.net <no...@so...> - 2012-07-09 17:57:48
|
Bugs item #3438213, was opened at 2011-11-15 02:12 Message generated for change (Comment added) made by foxyshadis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3438213&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: win32 Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Anthony (hovea) Assigned to: Mark Hammond (mhammond) Summary: astimezone could not process time on Pythonwin for 3.2 Initial Comment: Runing the testPersist.py Timezone processing failed on python32 returning Stat 1 pythoncom error: Unexpected exception in gateway method '<unknown>' ValueError: astimezone() cannot be applied to a naive datetime pythoncom error: Unexpected gateway error ValueError: astimezone() cannot be applied to a naive datetime Set Size0 Traceback (most recent call last): File "C:\Python32\Lib\site-packages\win32com\test\testPersist.py", line 204, in <module> test() File "C:\Python32\Lib\site-packages\win32com\test\testPersist.py", line 134, in test stcom = pythoncom.StgCreateDocfileOnILockBytes(lbcom, storagecon.STGM_DIRECT| storagecon.STGM_CREATE | storagecon.STGM_READWRITE | storagecon.STGM_SHARE_EXCLUSIVE, 0) pywintypes.com_error: (-2147467259, 'Unspecified error', None, None) ---------------------------------------------------------------------- Comment By: foxyshadis (foxyshadis) Date: 2012-07-09 10:57 Message: I'm using build 217 on py3.2 and still getting the same error in a different function: win32file.SetFileTime(winfile, wintime, None, None) ValueError: astimezone() cannot be applied to a naive datetime SetFileTime also makes use of PyWinObject_AsFILETIME() If I get a chance at work before anyone looks at it I'll try to set up a python build environment to see if the same fix will work for this function. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2012-01-01 22:55 Message: This is just a problem in testPersist.py, which I've fixed in 4181:cc10aa149c2c. I'll have a look at issue 2831327 next. ---------------------------------------------------------------------- Comment By: Jason R. Coombs (jaraco) Date: 2011-11-22 07:30 Message: Anthony, thanks for tracking this down. Mark, can you take a look at the proposed workaround. I don't understand the implications of the change, and I'm guessing you can do a better review of the patch than me. ---------------------------------------------------------------------- Comment By: Anthony (hovea) Date: 2011-11-22 00:49 Message: This issue could be fixed by change win32\src\PywinTypes.h from line 470 to 484 as follwings: #if (PY_VERSION_HEX < 0x03000000) # define NO_PYWINTYPES_TIME #endif // Python 2.3 doesn't have C Api for datetime, so can't have our new funky // support. #if (PY_VERSION_HEX >= 0x02040000) # define PYWIN_HAVE_DATETIME_CAPI #endif // XXX - fixme - ack - we don't yet like *both* defines existing - and for now // its only enabled in py3k #if (PY_VERSION_HEX > 0x03000000) # undef PYWIN_HAVE_DATETIME_CAPI #endif ########################################### This issue is caused by old, crap, custom time object, using standard one will be OK ---------------------------------------------------------------------- Comment By: Anthony (hovea) Date: 2011-11-21 19:26 Message: It's the same bug as https://sourceforge.net/tracker/?func=detail&aid=2831327&group_id=78018&atid=551954 Pytime in py3k does not work . ---------------------------------------------------------------------- Comment By: Anthony (hovea) Date: 2011-11-19 06:02 Message: This issues is cause in PyObject *PyIPropertyStorage::SetTimes(PyObject *self, PyObject *args). File PyIpropertyStorage.cpp line 622, which is called by Com Storage creation. PyWinObject_AsFILETIME not set the timezone information will cause failed of SetTimes. ---------------------------------------------------------------------- Comment By: Anthony (hovea) Date: 2011-11-16 01:02 Message: The Error is generated by pythoncom.StgCreateDocfileOnILockBytes call from testPersist.py" . Which is located in PyTime.cpp. line 806. I am building pywin by using VisualStudio 2008sp1. Simply Run setup.py build in the source code directory. When I am tracking down, it seems that from python3, astimezone should function should have timezone information to convert the correct time. I did not yet indentify where PyWinObject_AsSYSTEMTIME is called. ---------------------------------------------------------------------- Comment By: Jason R. Coombs (jaraco) Date: 2011-11-15 06:30 Message: I'm not familiar with building pywin32 from scratch. Are there instructions somewhere on how to build pywin32 on Python 3? I don't have VS2008 handy, so I tried using VS2010 and patched msvc9compilermodule with jaraco.develop.msvc (https://bitbucket.org/jaraco/jaraco.develop/src/5d0574e79d6f/jaraco/develop/msvc.py), but I'm still unable to build. Furthermore, I don't think this is an issue with win32timezone. "astimezone()" is a method on a datetime.datetime object (part of the stdlib). I don't think win32timezone comes into play. Furthermore, the text 'timezone' doesn't appear in testPersist.py. I don't understand what testPersist.py is trying to do. I think the errors about naive datetimes are coming from some other code which is opaque to testPersist. I don't feel qualified to address this issue, so I'm going to re-assign this to no one. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3438213&group_id=78018 |