Yes, I can see this. However, trunk runs fine for me. I don't yet know why was that.
Daniel On Mon, Jun 18, 2012 at 2:52 PM, Duckworth, Will <[email protected]>wrote: > I tried a couple other versions. > > This will work: > > #!/usr/bin/python > > import sys > > from org.apache.pig.scripting import Pig > > if __name__ == '__main__': > print sys.argv[1] > > > This will not: > > #!/usr/bin/python > > import sys > > from org.apache.pig.scripting import Pig > > @outputSchema("ip_address:long") > def Ip2Num(ip): > pass > > if __name__ == '__main__': > print sys.argv[1] > > > > > Will Duckworth Senior Vice President, Software Engineering | comScore, > Inc.(NASDAQ:SCOR) > o +1 (703) 438-2108 | m +1 (301) 606-2977 | mailto:[email protected] > > ..................................................................................................... > -----Original Message----- > From: Duckworth, Will [mailto:[email protected]] > Sent: Monday, June 18, 2012 5:19 PM > To: [email protected] > Subject: Getting sys.argv using embedded jython > > This has to be something obvious but I can’t seem to get python parameters > once I add in a main(). Thanks. > > ~/pig-0.10/bin/pig pytest.py haha > ... > 2012-06-18 17:11:50,312 [main] INFO > org.apache.pig.scripting.jython.JythonScriptEngine - created tmp > python.cachedir=/tmp/pig_jytho > n_9083561197267275440 > haha > > ~/pig-0.10/bin/pig pytest2.py haha > ... > 2012-06-18 17:13:25,609 [main] INFO > org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting > UDF: main > 2012-06-18 17:13:25,635 [main] ERROR org.apache.pig.Main - ERROR 1121: > Python Error. Traceback (most recent call last): > File "/home/wduckworth/pytest2.py", line 11, in <module> > print sys.argv[1] > IndexError: index out of range: 1 > > * * * pytest.py > > #!/usr/bin/python > > import sys > from org.apache.pig.scripting import Pig > print sys.argv[1] > > * * * pytest2.py > > #!/usr/bin/python > > import sys > from org.apache.pig.scripting import Pig > > def main(): > print sys.argv[1] > > if __name__ == '__main__': > main() > > > > > Will Duckworth Senior Vice President, Software Engineering | comScore, > Inc. (NASDAQ:SCOR) > > o +1 (703) 438-2108 | m +1 (301) 606-2977 | [email protected] > <mailto:[email protected]> > > > ........................................................................................................... > > Introducing Mobile Metrix 2.0 - The next generation of mobile behavioral > measurement > www.comscore.com/MobileMetrix< > http://www.comscore.com/Products_Services/Product_Index/Mobile_Metrix_2.0> > > >
