sh: test: argument expected
steve at holdenweb.com
Wed Nov 3 02:39:46 CET 2004
Iván Cabria wrote:
> I am a new user of python. I ran
> a python script and I got the
> following message:
> sh: test: argument expected
> I found that this error came from a
> line in the script:
> energy = atoms.GetPotentialEnergy()
> I looked for a solution to this
> problem in Internet and I found
> that the problem was that the variable
> was not initialised. I also found
> that the bash shell initialises the variables
> automatically and the Bourne shell (sh) does not.
> I suppose that 'sh:' in the error message
> means that the script is using the Bourne shell,
> and hence, I understand the message error.
> However, I was using the bash shell in the computer
> I ran the script, not
> the Bourne shell (sh). Hence, I do not
> understand the 'sh:' in the error message.
> Could be that python scripts are using by default the
> Bourne shell?
> The first line of the python script is:
> #!/usr/bin/env python
> Thanks in advance.
Question 1: if you run the script using "python scriptname.py" does the
error go away? If so then your script is being executed by the shell and
not by the python interpreter.
Question 2: Are there any blank lines or empty spaces before
#!/usr/bin/env python ?
Holden Web LLC +1 800 494 3119
More information about the Python-list