[
https://issues.apache.org/jira/browse/PIG-2548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228497#comment-13228497
]
Eli Finkelshteyn commented on PIG-2548:
---------------------------------------
This is pretty awesome, but what can one do when wanting to use Python's
getopt? Is there a pig substitute? When trying to do something like:
{code}
import getopt, sys
# explicitly import Pig class
from org.apache.pig.scripting import Pig
print sys.argv[1:]
options, remainder = getopt.getopt(sys.argv[1:], 'o:i:', ['output=',
'verbose',
'input=',
])
options = dict(options)
print options
params = {'input' : options['--input'] or options['-i'] or '',
'output' : options['--output'] or options[-'o'] or ''}
print params
print Pig.fs("ls " input)
{code}
The getopt portion works fine when running through Python, but when running
through pig, you wind up with:
{code}
[main] ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error.
Encountered unexpected arguments on command line - please check the command
line.
{code}
I'm thinking it would be quite nice to be able to pass named params to embedded
pig, no?
> Support for providing parameters to python script
> -------------------------------------------------
>
> Key: PIG-2548
> URL: https://issues.apache.org/jira/browse/PIG-2548
> Project: Pig
> Issue Type: New Feature
> Affects Versions: 0.9.1, 0.10
> Reporter: Vivek Padmanabhan
> Assignee: Daniel Dai
> Fix For: 0.10, 0.11
>
> Attachments: PIG-2548-1.patch
>
>
> If I have an embedded pig script in python, there is no way to get user
> passed parameters in the python script.
> Though PIG-2165 adds the capability of reading these params in the pig
> script, from python it is still not possible.
> It would be nice to have this feature if I have some sort of post processing
> happening in my python scrip based on the params.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira