python - Cannot launch exec in subprocess with path -
i'm trying launch executable python subprocess , have problem path. i'm trying run newman.cmd located in
c:\users\<myself>\appdata\roaming\npm i try
subprocess.run("c:\users\<myself>appdata\roaming\npm\newman.cmd run","shell=true") which fails, indicating:
syntax error: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \uxxxxxxxx escape: c:\knxnet\test_differentiel.py, line 71, pos 23 subprocess.run("c:\users\<myself>\appdata\roaming\npm\newman.cmd run","shell=true") if copy newman.cmd , appropriate folders in local path, end launching command expected, ie. works:
subprocess.run("newman.cmd -h") i checked path , gives me following:
env = <irrelevant info> ;c:\users\<myself>\appdata\roaming\npm so though find ? how can avoid copying executables in current directory ?
thanks ...
well, found out answer ... "unicode error "unicodeescape" codec can't decode bytes... cannot open text files in python 3
it interpreted unicode followed unwanted character ... position indicated in error quote's position, didn't catch hint. tried r:
subprocess.run(r"c:\users\a.joly\appdata\roaming\npm\newman.cmd -h") and works. works if double "\".
thanks time ...
Comments
Post a Comment