python - Hex characters in arguments to Popen -


i trying pass raw byte array process:

import subprocess cmd = ["./input"] cmd += "\x00" subprocess.popen(cmd) 

however, gives error:

typeerror: execv() arg 2 must contain strings 

how solve this?

this problem occurs me when include null terminator (\x00). every other value, works. try this:

for in range(256):     cmd = ["echo",chr(a)]     try:         c = subprocess.popen(cmd)     except typeerror:         print(a) 

this gave me 1 value: 0. @ guess, python gets confused when have double null terminators.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -