Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35542

RE: How to get time.strptime()?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <nick.cash@npcinternational.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'importing': 0.04; 'attribute': 0.05; 'error:': 0.05; 'startup': 0.05; 'subject:skip:t 10': 0.07; 'subject:How': 0.09; 'python': 0.09; 'broke': 0.09; 'expected.': 0.09; 'imported': 0.09; '3.1.3': 0.16; 'also:': 0.16; 'normally.': 0.16; 'threads': 0.16; 'url:detail': 0.16; 'url:issues': 0.16; 'webapp': 0.16; '(or': 0.18; 'module': 0.19; 'to:name:python-list@python.org': 0.20; 'trying': 0.21; 'import': 0.21; 'occurs': 0.22; 'errors': 0.23; 'to:2**1': 0.23; "i've": 0.23; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; '2.6': 0.27; 'received:216.32': 0.27; 'run': 0.28; 'normal.': 0.29; 'received:169': 0.29; 'url:code': 0.29; 'maybe': 0.29; 'error': 0.30; 'header:Received:8': 0.30; 'url:python': 0.32; 'running': 0.32; 'received:10.43': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'server': 0.35; 'received:bigfish.com': 0.35; 'url:org': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'you.': 0.61; 'received:216': 0.62; 'url:p': 0.63; 'subject:get': 0.81; 'url:177': 0.84
X-Forefront-Antispam-Report CIP:157.56.240.117; KIP:(null); UIP:(null); IPV:NLI; H:BL2PRD0610HT004.namprd06.prod.outlook.com; RD:none; EFVD:NLI
X-SpamScore -1
X-BigFish PS-1(zz1432Izz1de0h1202h1e76h1d1ah1d2ahzz8275bh8275dh17326ahz2fh2a8h668h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h1155h)
Received-SPF pass (mail213-ch1: domain of npcinternational.com designates 157.56.240.117 as permitted sender) client-ip=157.56.240.117; envelope-from=nick.cash@npcinternational.com; helo=BL2PRD0610HT004.namprd06.prod.outlook.com ; .outlook.com ;
From Nick Cash <nick.cash@npcinternational.com>
To Gnarlodious <gnarlodious@gmail.com>, "python-list@python.org" <python-list@python.org>
Subject RE: How to get time.strptime()?
Thread-Topic How to get time.strptime()?
Thread-Index AQHN44cIbpW82gzvKUSBaeL4xecgoZgrj/og
Date Wed, 26 Dec 2012 21:06:12 +0000
References <5692cd23-84e0-46d4-b48c-5c11a5377c0a@googlegroups.com>
In-Reply-To <5692cd23-84e0-46d4-b48c-5c11a5377c0a@googlegroups.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [70.166.238.194]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-OriginatorOrg npcinternational.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1298.1356555987.29569.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356555987 news.xs4all.nl 6849 [2001:888:2000:d::a6]:43683
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35542

Show key headers only | View raw


> Error: AttributeError: 'module' object has no attribute '_strptime'
> 
> This problem is driving me crazy. It only happens in Python 3.3.0,
> while on my server running 3.1.3 it behaves as expected. When I try to
> access time.strptime() it errors with
> 
> AttributeError: 'module' object has no attribute '_strptime'.
> 
> This error only occurs under mod_wsgi, when running as a one-shot
> webapp it behaves normally. All other functionalities of the time
> module are normal.

I've run into this issue in the past with Python 2.6 (or maybe 2.7) and mod_python. My problem was that datetime.strptime imported _strptime at runtime, and multiple threads trying to import it at the same time broke an internal import lock.

I was able to work around this by simply importing _strptime myself at server startup time. This may or may not work for you.

See also: http://code.google.com/p/modwsgi/issues/detail?id=177 and http://www.mail-archive.com/python-list@python.org/msg248664.html 

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 08:33 -0800
  Re: How to get time.strptime()? Chris Rebert <clp2@rebertia.com> - 2012-12-26 09:34 -0800
  Re: How to get time.strptime()? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-26 17:43 +0000
    Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 11:18 -0800
  RE: How to get time.strptime()? Nick Cash <nick.cash@npcinternational.com> - 2012-12-26 21:06 +0000
    Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 19:09 -0800
      Re: How to get time.strptime()? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-27 04:40 +0000
      Re: How to get time.strptime()? Roy Smith <roy@panix.com> - 2012-12-26 23:53 -0500
      Re: How to get time.strptime()? Mitya Sirenef <msirenef@lightbird.net> - 2012-12-27 00:06 -0500
      Re: How to get time.strptime()? Chris Angelico <rosuav@gmail.com> - 2012-12-27 16:41 +1100
        Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 22:19 -0800
        Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 22:19 -0800
      Re: How to get time.strptime()? Ben Finney <ben+python@benfinney.id.au> - 2012-12-27 17:24 +1100
    Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 19:09 -0800
  Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-27 16:33 -0800
    Re: How to get time.strptime()? Ian Kelly <ian.g.kelly@gmail.com> - 2012-12-27 19:47 -0700
      Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-27 19:48 -0800
      Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-27 19:48 -0800

csiph-web