FastNetMon

Sunday, 17 May 2015

Python: TypeError: execve() arg 3 contains a non-string value

This code will definitely produce this error:
new_env = os.environ.copy()
new_env['MY_ENV'] = 1234
subprocess.Popen( ['/bin/echo'], env=new_env)
How to fix? Add explicit conversion to str():
new_env = os.environ.copy()
new_env['MY_ENV'] = str(1234(
subprocess.Popen( ['/bin/echo'], env=new_env)

No comments :

Post a Comment

Note: only a member of this blog may post a comment.