Hi,
(Python 2.5, OS X 10.4.10)
I have a program called pdb2pqr on my system. It is installed so that
"pdb2pqr" is in my path and looks like:
#\!/bin/zsh -f
/sw/share/pdb2pqr/pdb2pqr.py "$@"
When I call it via this script:
#!/usr/bin/env python
import subprocess
import tempfile
args = ('/sw/bin/pdb2pqr','--help')
output_file = tempfile.TemporaryFile(mode="w+")
print "Running",args
retcode =
subprocess.call(args,stdout=output_file.fileno(),s tderr=subprocess.STDOUT)
output_file.close()
I get this error:
localhost~/tmp$ ./x.py
Running ('/sw/bin/pdb2pqr', '--help')
Traceback (most recent call last):
File "./x.py", line 9, in <module>
retcode =
subprocess.call(args,stdout=output_file.fileno(),s tderr=subprocess.STDOUT)
File "/sw/lib/python2.5/subprocess.py", line 443, in call
return Popen(*popenargs, **kwargs).wait()
File "/sw/lib/python2.5/subprocess.py", line 593, in __init__
errread, errwrite)
File "/sw/lib/python2.5/subprocess.py", line 1051, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
But when I change it to directly call the script that the zsh script
calls like this:
args = ('/sw/share/pdb2pqr/pdb2pqr.py','--help')
everything works:
localhost~/tmp$ ./x.py
Running ('/sw/share/pdb2pqr/pdb2pqr.py', '--help')
This is with 2.5 on OS X 10.4.10. I'm happy to provide whatever
additional information might be useful.
Thanks,
-michael 2 7494
Michael George Lerner <mg******@gmail.comwrites:
Hi,
(Python 2.5, OS X 10.4.10)
I have a program called pdb2pqr on my system. It is installed so that
"pdb2pqr" is in my path and looks like:
#\!/bin/zsh -f
Are you sure that this shebang is correct?
I've tested that on bash and have similar error:
# t1.sh
#\!/bin/sh
echo "t1"
>>from subprocess import call call(['./t1.sh'])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/subprocess.py", line 413, in call
return Popen(*args, **kwargs).wait()
File "/usr/lib/python2.4/subprocess.py", line 543, in __init__
errread, errwrite)
File "/usr/lib/python2.4/subprocess.py", line 975, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
But running that directly through the shell works:
>>call(['./t1.sh'], shell=True)
t1
0
However this script works fine also without `shell=True` option:
# t2.sh
#!/bin/sh
echo "t2"
>>call(['./t2.sh'])
t2
0
HTH,
Rob
On Nov 11, 3:25 pm, Rob Wolfe <r...@smsnet.plwrote:
Hi Rob,
Michael GeorgeLerner<mgler...@gmail.comwrites:
Hi,
(Python 2.5, OS X 10.4.10)
I have a program called pdb2pqr on my system. It is installed so that
"pdb2pqr" is in my path and looks like:
#\!/bin/zsh -f
Are you sure that this shebang is correct?
Well, it's correct in the sense that I have faithfully reproduced the
contents of the file. I didn't write it, though.
I don't know what the extra backslash is for. I suppose I'll contact
the authors and find out.
Any ideas how to make it work with the strange shebang syntax?
Thanks,
-michael
>
I've tested that on bash and have similar error:
# t1.sh
#\!/bin/sh
echo "t1"
>from subprocess import call call(['./t1.sh'])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/subprocess.py", line 413, in call
return Popen(*args, **kwargs).wait()
File "/usr/lib/python2.4/subprocess.py", line 543, in __init__
errread, errwrite)
File "/usr/lib/python2.4/subprocess.py", line 975, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
But running that directly through the shell works:
>call(['./t1.sh'], shell=True)
t1
0
However this script works fine also without `shell=True` option:
# t2.sh
#!/bin/sh
echo "t2"
>call(['./t2.sh'])
t2
0
HTH,
Rob
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Piotr Wolski |
last post by:
This message usually indicates there is a problem with the script
itself. Often this indicates either that the #! line of the script
is incorrect, or the script was uploaded in binary mode instead...
|
by: Matthew Fowler |
last post by:
Hi there
I have been porting python to the Etrax platform and everything seems to
be working.
However when I run the program in question I get:
"problem with execution of xhpl on ...
|
by: Alec Wysoker |
last post by:
Using Python 2.3.5 on Windows XP, I occasionally get OSError: Permission denied when calling os.remove(). This can occur with a
file that is not used by any other process on the machine, and is...
|
by: Joram Agten |
last post by:
Please put me in CC
When running the following program I get frequent errors like this one
Exception in thread Thread-4:
Traceback (most recent call last):
File...
|
by: k r fry |
last post by:
Hi, I am new to this list and also programming with python.
I have an error: oserror not a directory "katiescint.py"
The piece of code causing the problem is:
for subdir in...
|
by: robert |
last post by:
e.g. open/os module functions (os.path.getmtime...) and
win32api/win32file functions fail on long paths (>~255 chars)
even the '\\?\' trick from...
|
by: Pradeep83 |
last post by:
Hi All,
Good Morning
Here I am jotdowning my problem
I am compiling a .c file in Free BSD 6.0 and exceuting there itself.
and i have taken that...
|
by: timw.google |
last post by:
Hi
I want to write a python script that runs rsync on a given directory
and host. I build the command line string, but when I try to run
subprocess.call(cmd), or p=subprocess.Popen(cmd,...
|
by: siavashr |
last post by:
Hi,
I am new to python, and I am trying to do the following from my python code:
echo 1 > /sys/devices/omapdss/display0/enabled
I have tried to do this with the following functions:
...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |