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


Groups > comp.lang.python > #52779

utcoffset v. _utcoffset

Path csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1377108330; bh=aPruth/UnPKkmE+7GddAl7d2brd3cmbca36Lxupkh6k=; h=Date:Subject:From:To:From; b=Rup+NU69Fz3UYCQ3Ts9jHceByAgYSnAtuv5ndOCI+29hmtMia5ytlgxiYFyJf42VK Bhy8TxBgGHnE77vQv8W5H0gWCf6zpx08rErWs9XPeJhG4STjaeyHXQEdg+8OQ9ZjZG EQimORRJrrbLwo4OvnAlh7OzgTK4L3aFEK+evkKw=
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '(python': 0.07; 'attribute': 0.07; 'elements.': 0.07; 'skip:" 60': 0.07; 'python': 0.11; '1.5,': 0.16; 'attribute,': 0.16; 'from:addr:skip': 0.16; 'from:addr:python.org': 0.16; 'sender:addr:gmail.com': 0.17; 'import': 0.22; 'skip': 0.24; 'versions': 0.24; 'skip:" 30': 0.26; 'updating': 0.26; 'skip:p 30': 0.29; 'newer': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; '(most': 0.33; 'mac': 0.33; 'older': 0.33; 'trouble': 0.34; 'skip:d 20': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'little': 0.38; 'recent': 0.39; 'realize': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'most': 0.60; 'subject:. ': 0.67; 'home': 0.69; 'latest,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=P7KtFGHtHJoDCoPWjzZdHeCieLCUwkJCwbJflxTrw3s=; b=Ur7iYeY1L+Ro+xc38Q75itkacVcoDYfIXrOol2KX//ENwdY7ESdu64BnUkbS55x2h/ ds9DSkGyOM2ICiXmTu7lCnvdfOD+tjzBTYb0Af6GnHp55vlwtzWrfG5WLrsmzIkIVyBI 1bYSS91dKV1xfV/KM9+xgoOKYbZqoo7sO70uxFy58jUEef+I4XtPkTrzNBvox3ahcJZJ mUPzSdNEmFn0cCufTf08+be6U8mPfoxCcyORyngmdh2zFViLoPbRJImaRMr6tsUFKUFU DRxfEjHF2p8DoPpZ48B1g3aVFFJQe7pV2vG+hb/bu2skY1v8S0HABSX0oZSMivmIOGk1 0v7Q==
MIME-Version 1.0
X-Received by 10.220.16.73 with SMTP id n9mr3007219vca.24.1377108329372; Wed, 21 Aug 2013 11:05:29 -0700 (PDT)
Sender skip.montanaro@gmail.com
Date Wed, 21 Aug 2013 13:05:29 -0500
X-Google-Sender-Auth scNawCWGiGuO5RxlP68bO-KOUbU
Subject utcoffset v. _utcoffset
From Skip Montanaro <skip@python.org>
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.91.1377108332.19984.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377108332 news.xs4all.nl 15920 [2001:888:2000:d::a6]:59553
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52779

Show key headers only | View raw


Consider this little Python script:

import dateutil.parser
import pytz

x = dateutil.parser.parse("2013-08-16 23:00:00+01:00")
localtz = pytz.timezone("America/Chicago")
y = localtz.normalize(x)

When I execute it (Python 2.7.2, dateutil 1.5, pytz 2011h), I get this
traceback:

Traceback (most recent call last):
  File "/home/skipm/tmp/localtzex.py", line 8, in <module>
    y = localtz.normalize(x)
  File "/opt/TWWfsw/python27p/lib/python2.7/site-packages/pytz/tzinfo.py",
line 233, in normalize
    offset = dt.tzinfo._utcoffset
AttributeError: 'tzoffset' object has no attribute '_utcoffset'

Looking at the tzinfo attribute, I see that it has "utcoffset", but
not "_utcoffset".  I realize those are the latest, most up-to-datest
versions of all three elements.  I'm having trouble updating dateutil
and pytz on my Mac at home (stuck on even older versions).  Can
someone with newer versions of dateutil and pytz see if this problem
is still present?

Thx,

Skip

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


Thread

utcoffset v. _utcoffset Skip Montanaro <skip@python.org> - 2013-08-21 13:05 -0500

csiph-web