Re: fromutc: dt.tzinfo is not self: pytz.timezone('UTC').fromutc(datetime.utcnow())
- From: Steven D'Aprano <steve+comp.lang.python@xxxxxxxxxxxxx>
- Date: 19 Oct 2011 21:03:21 GMT
On Wed, 19 Oct 2011 01:06:53 -0700, aspineux wrote:
hi
datetime.datetime(2011, 10, 19, 7, 54, 45, 579125, tzinfo=<StaticTzInfoimport pytz
from datetime import datetime
pytz.timezone('GMT0').fromutc(datetime.utcnow())
'GMT0'>)
Traceback (most recent call last):pytz.timezone('UTC').fromutc(datetime.utcnow())
File "<stdin>", line 1, in <module>
ValueError: fromutc: dt.tzinfo is not self
datetime.datetime(2011, 10, 19, 9, 55, 47, 787937, tzinfo=<DstTzInfopytz.timezone('Europe/Brussels').fromutc(datetime.utcnow())
'Europe/Brussels' CEST+2:00:00 DST>)
Why does UTC fail ?
Bug or feature ?
Looks like a bug to me. But I'm not an expert on pytz. Perhaps you should
report it back to the package author.
--
Steven
.
- Follow-Ups:
- References:
- Prev by Date: Re: Python based silent installer, how to?
- Next by Date: Re: Benefit and belief
- Previous by thread: Re: fromutc: dt.tzinfo is not self: pytz.timezone('UTC').fromutc(datetime.utcnow())
- Next by thread: Re: fromutc: dt.tzinfo is not self: pytz.timezone('UTC').fromutc(datetime.utcnow())
- Index(es):
Relevant Pages
|