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


Groups > comp.lang.python > #52793

Re: utcoffset v. _utcoffset

Path csiph.com!usenet.pasdenom.info!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '(python': 0.07; 'attribute': 0.07; 'elements.': 0.07; 'skip:" 60': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '1.5,': 0.16; 'attribute,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'skip': 0.24; 'versions': 0.24; 'skip:" 30': 0.26; 'updating': 0.26; 'header:X -Complaints-To:1': 0.27; 'skip:p 30': 0.29; 'newer': 0.30; 'returned': 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; 'charset:us-ascii': 0.36; 'to:addr :python-list': 0.38; 'little': 0.38; 'recent': 0.39; 'realize': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'most': 0.60; 'subject:. ': 0.67; 'believe': 0.68; 'home': 0.69; 'received:204': 0.75; 'article': 0.77; 'latest,': 0.84; 'received:204.14': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ned Deily <nad@acm.org>
Subject Re: utcoffset v. _utcoffset
Date Wed, 21 Aug 2013 13:33:50 -0700
References <CANc-5UwRWF343mmOeCJhKj6KaU1m4=qGXHrb3PXv1X5_OD-cgA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 204.14.154.197
User-Agent MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
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.103.1377117250.19984.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377117250 news.xs4all.nl 15926 [2001:888:2000:d::a6]:42271
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52793

Show key headers only | View raw


In article 
<CANc-5UwRWF343mmOeCJhKj6KaU1m4=qGXHrb3PXv1X5_OD-cgA@mail.gmail.com>,
 Skip Montanaro <skip@python.org> wrote:

> 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?

I believe the problem is that you are using them incorrectly.  
IAMNADatetimeExpert, but I think you are trying to normalize a 
non-tz-aware datetime object returned from dateutil.parser.parse.

-- 
 Ned Deily,
 nad@acm.org

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


Thread

Re: utcoffset v. _utcoffset Ned Deily <nad@acm.org> - 2013-08-21 13:33 -0700

csiph-web