On Oct 3, 5:03 pm, cschand <[EMAIL PROTECTED]> wrote:
> I tracked where the error coming form. It's at the time of reading the
> file
>
> In local system the output is
>
> >>> import os.path
> >>> base = os.path.join(os.getcwd(), 'external_apps/pytz/zoneinfo')
> >>> zone = 'Australia/Melbourne'
> >>> fp = open(os.path.join(base, 'Australia', 'Melbourne'), 'rb')
> >>> from cStringIO import StringIO
> >>> from datetime import datetime, timedelta
> >>> from struct import unpack, calcsize
>
> >>> from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
> >>> from pytz.tzinfo import memorized_datetime, memorized_timedelta
>
> >>> head_fmt = '>4s 16x 6l'
> >>> head_size = calcsize(head_fmt)
> >>> (magic,ttisgmtcnt,ttisstdcnt,leapcnt,
>
> ...  timecnt,typecnt,charcnt) =  unpack(head_fmt, fp.read(head_size))
>
>
>
> >>> # Make sure it is a tzinfo(5) file
> >>> assert magic == 'TZif'
>
> >>> magic
> 'TZif'
> >>> ttisgmtcnt
> 4
> >>> ttisstdcnt
> 4
> >>> leapcnt
> 0
> >>> timecnt
> 141
> >>> typecnt
> 4
> >>> charcnt
> 4
>
> >>> # Read out the transition times, localtime indices and ttinfo structures.
> >>> data_fmt = '>%(timecnt)dl %(timecnt)dB %(ttinfo)s %(charcnt)ds' % dict(
>
> ...     timecnt=timecnt, ttinfo='lBB'*typecnt, charcnt=charcnt)
>
> >>> data_fmt
>
> '>141l 141B lBBlBBlBBlBB 4s'
>
> >>> data_size = calcsize(data_fmt)
>
> >>> data_size
> 733
> >>> fp.read(data_size)
>
> '\x9cN\xa6\x9c\x9c\xbc \xf0\xcbT\xb3\x00\xcb\xc7Wp\xcc\xb7V\x80\xcd
> \xa79p\xce\xa0s\x00\xcf\x87\x1bp\x03p9
> ...................................................................................
> ...................................................................................
> \x03\x02\x03\x02\x03\x02\x00\x00\x9a\xb0\x01\x00\x00\x00\x8c
> \xa0\x00\x00\x00\x00\x9a\xb0\x01\x00\x00\x00\x8c\xa0\x00\x00EST\x00'
>
>
>
> and in hosting server (webfaction server) the out put at the time or
> read the data is
>
> >>> fp.read(data_size)
>
> '\x9cN\xa6\x9c\x9c\xbc \xf0\xcbT\xb3\x00\xcb\xc7Wp\xcc\xb7V\x80\xcd
> \xa79p\xce\xa0s\x00\xcf\x87\x1bp\x03p9
> ....................................................................................
> ...................................................................................
> \x03\x02\x03\x02\x03\x02\x00\x00\x9a\xb0\x01\x00\x00\x00\x8c
> \xa0\x00\x00\x00\x00\x9a\xb0\x01\x00\x00\x00\x8c\xa0\x00\x00E'
>
> In localhost reads upto \x00EST\x00' and in live host only upto
> \x00E'
>
> Why this happens? Can you help me?
>
> Satheesh
>
> On Oct 3, 2:07 pm, cschand <[EMAIL PROTECTED]> wrote:
>
> > Hi all
> >   I have a problem with pytz.
>
> > In my local system i tried with pytz and its working fine
>
> > >>> from pytz.tzfile import build_tzinfo
> > >>> import os.path
> > >>> base = os.path.join(os.getcwd(), 'external_apps/pytz/zoneinfo')
> > >>> tz = build_tzinfo('US/Eastern', open(os.path.join(base, 'US', 
> > >>> 'Eastern'), 'rb'))
> > >>> tz
>
> > <DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>
>
> > Its works fine
> > But when i tried with my hosting server build_tzinfo() raises an
> > IndexError
>
> > >>> tz = build_tzinfo('US/Eastern', open(os.path.join(base, 'US', 
> > >>> 'Eastern'), 'rb'))
>
> > Traceback (most recent call last):
> >   File "<console>", line 1, in ?
> >   File "/home/infocean/webapps/site/yoke/external_apps/pytz/
> > tzfile.py", line 65, in build_tzinfo
> >     # Early dates use the first standard time ttinfo
> > IndexError: list index out of range
>
> > What's wrong with the hosting server? Does it need any additional
> > packages?
>
> > Satheesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to