ich will folgendes ausführen:
Code: Alles auswählen
cmd = "avr-nm -n file.elf > file.sym"
file = open("file.sym", "w")
file.close()
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
stdout = process.communicate()[0]
print stdout
Code: Alles auswählen
cmd = "avr-nm -n file.elf > file.sym"
file = open("file.sym", "w")
file.close()
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
stdout = process.communicate()[0]
print stdout
Du verwechselst Python mit ner Shell?bronkopavel hat geschrieben:Was mache ich falsch?
Code: Alles auswählen
cmd = ["avr-nm", "-n", "file.elf"]
with open("file.sym", "w") as fobj:
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
fobj.write(process.communicate()[0])
Ich habe die ZeilenDein Command-Handling ist btw recht fahrlaessig.
Code: Alles auswählen
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
stdout = process.communicate()[0]
print stdout
Code: Alles auswählen
returncode = subprocess.call(["avr-nm", "-n", "file.elf"], stdout=open("file.sym", "w"))
Code: Alles auswählen
cmdLine = list()
cmdLine.append(r'--set-section-flags=.eeprom="alloc,load"')
print cmdLine
print "REAL CMD LINE: ", subprocess.list2cmdline(cmdLine)
Warum ist der String in der Liste plötzlich mit zwei \ ??['--set-section-flags=.eeprom="alloc,load"']
REAL CMD LINE: --set-section-flags=.eeprom=\"alloc,load\"