I do a lot of Python streaming functions in Pig.  I checked, and one of
them even uses pytz.timezone(time_zone), but I haven't had that error.

One problem I had early on with Pythin SFs in Pig is that my slave nodes
had trouble importing my own Python code.  I solved this my putting all my
own code on a NFS server and made sure the master and all slaves mounted
it.  Obviously, you are not having an import problem.  But it made me think
about master vs. slave setup issues.

Try running the python code on each of the slaves and the master outside of
Pig.  Make sure that all nodes on the cluster run the save versions of
Python and pytz.  Also, find out if the list of know time zones is coded
directly in pytz, or if it gets a list from somewhere in an OS library.

Also, try passing 'UTC'.

Actually, I just looked in my putz source and saw this tidbit:

try:
    zone = ascii(zone)
except UnicodeEncodeError:
    # All valid timezones are ASCII
    raise UnknownTimeZoneError(zone)

And the ascii(zone) function ends up doing zone.encode('US-ASCII') .
Maybe there's a problem with your string encoding?  You should be
getting a trace from your error to tell you where in pytz the
exception is occurring, I think.


Good luck,

    Steve


On Thu, Sep 1, 2016 at 8:46 AM, Olaf Collider <[email protected]>
wrote:

> Hello everybody!
>
> I use the following code in my udfs.py
>
> import sys
> sys.path.append(path_to_libs)
> import pytz
>
> but then Pig send back an error at line
>
> to_zone=pytz.timezone('America/New_York')
>
> saying that pytz.exception.UnknownTimeZoneError : 'America/New_York'
>
> this error drives me crazy!!! Pytz is correctly installed.. Any idea whats
> going on? The other udfs (including datetime) work just fine
>
> Thanks!!!
>

Reply via email to