[Zope3-dev] time.strptime doesn't exist in 2.2 everywhere

Tim Peters tim.one@comcast.net
Wed, 08 Jan 2003 15:15:49 -0500


I'm seeing 360 new Zope3 test failures on Windows, using Python 2.2.2.
They're all of this nature (this is the first one):

======================================================================
ERROR: testEra (zope.i18n.tests.test_formats.TestBuildDateTimeParseInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Code\Zope3\src\zope\i18n\tests\test_formats.py", line 137, in
setUp
    self.locale = ICUXMLLocaleFactory(path)()
  File "C:\Code\Zope3\src\zope\i18n\locales.py", line 1022, in __call__
    for version in self._extractVersions():
  File "C:\Code\Zope3\src\zope\i18n\locales.py", line 763, in
_extractVersions
    date = time.strptime(date, '%a %b %d %H:%M:%S %Y')
AttributeError: 'module' object has no attribute 'strptime'



The problem is that strptime isn't an ANSI C function, so its availability
is platform-dependent.  Python 2.3 adds a Python implementation of strptime
so that the function is available everywhere, but before 2.3 (incluing
2.2.2) strptime is only available under most (not all) flavors of Unix.

I believe the only use of strptime in Zope3 is in the locales.py line listed
above in the traceback, so there are probably many ways around this.
Somebody who understands this subsystem should pick one <wink>.