You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Benjamin Smedberg <be...@smedbergs.us> on 2012/08/15 00:23:17 UTC

python UDF error: "no os specific module found" when importing os

I am trying now to write a UDF in python.

I'm currently using 0.10.0 release. I have replaced the jython.jar with 
the standalone version as per https://issues.apache.org/jira/browse/PIG-2665

I end up indirectly importing "os" and hit the following error:

   File "/home/bsmedberg/jython-installed/Lib/os.py", line 118, in <module>
     raise ImportError, 'no os specific module found'
ImportError: no os specific module found

After a bit of debugging, this is apparently caused by 
sys.builtin_module_names not including 'posix' when running in the pig 
environment.

If I run `java -cp pig-0.10.0/lib/jython.jar org.python.util.jython` to 
get a python shell I can successfully `import os` and 
sys.builtin_module_names does include 'posix'.

Has anyone else experienced this before or have suggestions for how I 
can diagnose/fix this error?

--BDS