sh: test: argument expected

Steve Holden steve at
Mon Nov 8 13:42:02 CET 2004

Iván Cabria wrote:

> Hi,   
> I have run the script using "python" and the error does    
> not go away. I got the same error: 
> sh: test: argument expected 
> I have checked again that the first line of the python script is   
> #!/usr/bin/env python   
> There are no blank lines or empty spaces before    
> #!/usr/bin/env python   
> I also did "grep loginname /etc/passwd" to confirm I was using bash, and the  
> line I got ended with   
> :/usr/bin/bash   

That's as may be, but I can't escape the conclusion that your script is 
involving the shell somehow - maybe the GetPotentialEnergy() method 
calls os.system() or some other piece of functionality.

About all I can say is that the error message you are seeing is 
definitely NOT from the Python interpreter. Try putting a print 
statement of some kinf as the second loine of your script and make sure 
that Python is actually running that script. If it is, you'll need to 
find out where it's calling shell functionality.

Holden Web LLC +1 800 494 3119

More information about the Python-list mailing list