sh: test: argument expected

I

Iván Cabria

Hi,

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
(http://www.experts-exchange.com/Operating_Systems/Unix/Q_20706303.html)
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.
(http://www.experts-exchange.com/Operating_Systems/Unix/Q_20706303.html)

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.




Iván Cabria
Departamento de Física Teórica
Facultad de Ciencias
Universidad de Valladolid
Paseo del Prado de la Magdalena s/n
47005 Valladolid
SPAIN
Phone: 34-983-184436
Fax: 34-983-423013
e-mail: (e-mail address removed)
web page:
http://lab2.fam.cie.uva.es/~cabria
 
J

Jeremy Fincher

Iván Cabria said:
Hi,

I am a new user of python. I ran
a python script and I got the
following message:

sh: test: argument expected

The first line of the python script is:
#!/usr/bin/env python

Check that again, I suspect it's wrong. The error you're getting is
the exact error I get when that line isn't correct or isn't present in
my python scripts.

Run your script as "python <script>" and if you don't get that error,
you can be assured that the first line is the problem.

Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top