문제

I have a Python3 script that can take optional command line parameters which the script reads via sys.argv. My script works fine if I run it from a terminal window, however any time I add it to the PA schedule tab with parameters, I get a bash 126 exit code in the log. According to the bash appendix this exit code means Permission problem or command is not an executable. So, it would appear that the scripts running from a terminal window don't run in the same context as scripts run from schedule, because my script runs fine from a bash terminal.

What I need is to figure out a way to get scripts to run with optional command line parameters via the schedule tab.

I figure I could write another script that calls the first script with the optional parameters, however it seems to me there should be another way to get around this where you can just put the parameters you wish to run the script with directly on the line you give to the schedule tab to run. Otherwise I'll have to write a script for each separate set of parameters I want to call with versus just an entry to schedule the script to run.

도움이 되었습니까?

해결책

Thanks to @Lattyware for this solution. If you have this problem you can solve it by going to a terminal and adding the execute bit on your script. You can accomplish adding the execute permission using chmod such as:

chmod 700 foo.py

You may also want to verify your file permissions prior to any changes to ensure you don't add or remove something you didn't intend to.

You can read up on chmod here if you need to.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top