Note that there are some explanatory texts on larger screens.

plurals
  1. POPython subprocess Exec format error
    primarykey
    data
    text
    <p>Sorry if this question is dumb. I am using python <code>subprocess</code> statement to call a .bat file in Ubuntu (Natty 11.04), however, I got error messages:</p> <pre><code>Traceback (most recent call last): File "pfam_picloud.py", line 40, in &lt;module&gt; a=subprocess.Popen(src2, shell=0) File "/usr/lib/python2.7/subprocess.py", line 672, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child raise child_exception </code></pre> <h3>run this python file</h3> <pre><code>$python pfam_picloud.py </code></pre> <h3>Python code (pfam_picloud.py)</h3> <pre><code>#!/usr/bin/python # met="wTest.dvf" run="run_pfam.bat" inp="pfam_input.PFA" import os import stat import shutil import subprocess import string import random # Generate a random ID for file save def id_generator(size=6, chars=string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for x in range(size)) name_temp=id_generator() cwd=os.getcwd() src=cwd src1=cwd+'/'+name_temp if not os.path.exists(src1): os.makedirs(src1) else: shutil.rmtree(src1) os.makedirs(src1) ## shutil.copy(src+"/"+run,src1) shutil.copy(src+"/"+met,src1) shutil.copy(cwd+"/pfam_pi.exe",src1) shutil.copy(src+"/"+inp,src1) # src2=src1+"/run_pfam.bat" os.chdir(src1) a=subprocess.Popen(src2, shell=0) a.wait() </code></pre> <h3>bash file (run_pfam.bat)</h3> <pre><code>#!/bin/sh ./pfam_pi.exe pfam_input.PFA </code></pre> <p>I can successfully run this bash file in Ubuntu. So I guess, I messed up something in my Python script. Could anyone give me some suggestions? Thanks for any inputs.</p> <h3>EDIT</h3> <p>the file <code>pfam_pi.exe</code> is a Linux executable. I compiled it in Ubuntu. Sorry for the confusion.</p> <h3>update</h3> <p>Well, I got different types of error now. 1. With <code>#!/bin/sh</code>, it said <code>No such file or directory</code>. 2. With <code>/bin/sh</code>, it said <code>exec format error</code>. 3. If I sent everything as arguments <code>a=subprocess.Popen(['./pfam_pi.exe', 'inp', 'src1'], shell=0)</code>, it said <code>end of line symbol error</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload