1 year ago

#382847

test-img

verm-luh

Unable to call srec_cat via python subprocess module

I'm trying to call srec_cat from inside a python script by using the subprocess module, but it doesn't seem to work. Calling .\bin\srec_cat.exe c:\\temp\\2.hex -Intel -o c:\\temp\\2.srec -Motorola just works fine, but calling srec_cat by utilizing the subprocess module like this

# build_s19_demo.py
import subprocess

parameter = 'c:\\temp\\2.hex -Intel -o c:\\temp\\2.srec -Motorola'
output = subprocess.run([".\\bin\\srec_cat.exe", parameter], capture_output=True)
print (output)
print (output.stderr.decode('ASCII'))

doesn't seem to work:

ā”–ī˜‚  python .\build_s19_demo.py
CompletedProcess(args=['.\\bin\\srec_cat.exe', 'c:\\temp\\2.hex -Intel -o c:\\temp\\2.srec -Motorola'], returncode=1, stdout=b'', stderr=b'srec_cat: c:\\temp\\2.hex -Intel -o c:\\temp\\2.srec -Motorola: open: Invalid\r\n    argument\r\n')
srec_cat: c:\temp\2.hex -Intel -o c:\temp\2.srec -Motorola: open: Invalid
    argument

Can anybody give me a hint what I'm doing wrong here?

python

subprocess

srec-cat

0 Answers

Your Answer

Accepted video resources