You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Juan Martin Pampliega <jp...@gmail.com> on 2012/03/04 00:11:33 UTC

Problem running Pig script with Jython

Hi,

I'm currently trying to run the following Jython script:

#!/usr/bin/python

from org.apache.pig.scripting import *

res = Pig.compile("""loaded1 = LOAD 'hbase://tfinger' USING
org.apache.pig.backend.hadoop.hbase.HBaseStorage('group_str:*', '-loadKey
true') AS (id:chararray, group:map[]);dump loaded1;""").bind().runSingle()
if res.isSuccessful():
  print 'SUCCESS'
else:
  print 'FAIL'

When I run it directly as a Pig script with the command "pig -x local
[RunPigScript.py]" it works fine. When I run it through Eclipse or directly
from the commandline with the Jython command I get the following error:


Traceback (most recent call last):
  File "RunPigScript.py", line 11, in <module>
    pig = Pig.compile("""
at org.apache.pig.scripting.Pig.getScriptContext(Pig.java:373)
at org.apache.pig.scripting.Pig.compile(Pig.java:158)
at org.apache.pig.scripting.Pig.compile(Pig.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

java.io.IOException: java.io.IOException: Script context is not set

Any ideas on how to get around this issue? I'm running Pig 0.9.1 on local
mode.

Re: Problem running Pig script with Jython

Posted by Juan Martin Pampliega <jp...@gmail.com>.
Hi,

Sory for being repetitive but I just wanted to know if anyone had any idea
about how to get around this issue.

On Sat, Mar 3, 2012 at 8:11 PM, Juan Martin Pampliega
<jp...@gmail.com>wrote:

> Hi,
>
> I'm currently trying to run the following Jython script:
>
> #!/usr/bin/python
>
> from org.apache.pig.scripting import *
>
> res = Pig.compile("""loaded1 = LOAD 'hbase://tfinger' USING
> org.apache.pig.backend.hadoop.hbase.HBaseStorage('group_str:*', '-loadKey
> true') AS (id:chararray, group:map[]);dump loaded1;""").bind().runSingle()
> if res.isSuccessful():
>   print 'SUCCESS'
> else:
>   print 'FAIL'
>
> When I run it directly as a Pig script with the command "pig -x local
> [RunPigScript.py]" it works fine. When I run it through Eclipse or directly
> from the commandline with the Jython command I get the following error:
>
>
> Traceback (most recent call last):
>   File "RunPigScript.py", line 11, in <module>
>     pig = Pig.compile("""
> at org.apache.pig.scripting.Pig.getScriptContext(Pig.java:373)
>  at org.apache.pig.scripting.Pig.compile(Pig.java:158)
> at org.apache.pig.scripting.Pig.compile(Pig.java:145)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> java.io.IOException: java.io.IOException: Script context is not set
>
> Any ideas on how to get around this issue? I'm running Pig 0.9.1 on local
> mode.
>