I have two script, one for generate data.
main.py
import numpy as np
import os
data = np.array([[1,2,3,4],dtype=np.float32)
os.system("python draw.py "+data.tostring())
Another one for plot:
draw.py
import numpy as np
param = np.fromstring(sys.argv[1], dtype=np.float32)
print param
I just want to pass the numpy variable to another script through string,However, When I tried to use this command to run.
python main.py
I got this:
----> 1 os.system("python draw.py "+data.tostring())
TypeError: must be string without null bytes, not str
I think it's because the splashes, but I don't know how to deal with it. It there any body faced this problem before?