Python raise child_exception OSError: [Errno 8] Exec format error

I need to move a python script from a server using Python 2.6 to another that uses 2.4.

I had to make some changes. now i'm stuck. i keep getting this error

File "subprocess.py", line 975, in _execute_child raise child_exception OSError: [Errno 8] Exec format error 

my log ouput:

 Traceback (most recent call last): File "/cnfs/dev/regions/que/cli/rpntrans_requests/scripts/0.6a/process.py", line 281, in ? process(filename) File "/cnfs/dev/regions/que/cli/rpntrans_requests/scripts/0.6a/process.py", line 259, in process outputs = transformations[tr.tag](file).execute() File "/cnfs/dev/regions/que/cli/rpntrans_requests/scripts/0.6a/process.py", line 114, in execute t.execute() File "/cnfs/dev/regions/que/cli/rpntrans/current/rpntrans.py", line 113, in execute last_step.execute() File "/cnfs/dev/regions/que/cli/rpntrans/current/rpntrans.py", line 941, in execute stdout=sys.stdout, stderr=sys.stderr File "subprocess.py", line 413, in call return Popen(*args, **kwargs).wait() File "subprocess.py", line 543, in __init__ errread, errwrite) File "subprocess.py", line 975, in _execute_child raise child_exception OSError: [Errno 8] Exec format error 

code from rpntrans.py

  subprocess.call([ os.path.join(module_root, 'bin/fst2r2c'), file, v_name, str(r.ip2), str(r.ip2), out_file, '1', '0', '%s (ip1:%i)' % (self.dict[v_name]["desc"], r.ip1), self.dict[v_name]["units"], self.format, self.__get_interpolation(v_name) ], stdout=sys.stdout, stderr=sys.stderr ) 

Any phone have an idea?

Thank you

+4
source share
2 answers

If bin/fst2r2c is a binary executable, is it the correct format for the new server? (Have you moved from Linux to BSD or from 32-bit to 64-bit?)

If bin/fst2r2c is a script, is its line #! intact? (You edited it on Windows and presented \r ? Is the path to its executable different on the new computer, for example. /usr/bin vs. /usr/local/bin ?)

+15
source

Run the command you want to call from subprocess from the command line and see if it works. Then print the command you create with Python, i.e. os.path.join(module_root, 'bin/fst2r2c') and see if it looks the same.

0
source

Source: https://habr.com/ru/post/1484489/


All Articles