0

I have this python script:

#!/usr/bin/python

print 'hi'

I'm trying to send this script as a job to be executed on a computing cluster. I'm sending it with qsub like this: qsub myscript.py

Before running it I executed the following:

chmod +x myscript.py

However when I open the output file I find this:

Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.

And when I open the error file I find this:

print: Command not found.

So what's wrong?!

Edit: I followed the instructions in this question

Community
  • 1
  • 1
Jack Twain
  • 6,273
  • 15
  • 67
  • 107

2 Answers2

0

It looks like qsub isn't reading your shebang line, so is simply executing your script using the shell.

This answer provides a few options on how to deal with this, depending on your system: How can I use qsub with Python from the command line?

Community
  • 1
  • 1
ford
  • 10,687
  • 3
  • 47
  • 54
0

An option is to set the interpreter to python like so:

qsub -S /usr/bin/python  myscript.py

I am quite sure there is an alternate way to do this without the -S option and have SGE execute the code based on interpreter in the shebang; however, this solution might be enough for you needs.

Also, concerning this output:

Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.

It seems safe to ignore this:

http://www.linuxquestions.org/questions/linux-software-2/warning-no-access-to-tty-bad-file-descriptor-702671/

EDIT:

Also works:

qsub <<< "./myscript.py"
qsub <<< "python ./myscript.py"
Vince
  • 3,325
  • 2
  • 23
  • 41