subprocess execv() arg 2 must contain only strings

subprocess 調用的cmd中含有中文,以下
cmd="\cp -f %s %s"%(x, y),y是前臺傳入的中文參數
調用Popen致使以下錯誤:
execv() arg 2 must contain only stringsshell

以下修改:
subprocess.Popen(cmd.encode('utf-8'), shell=True)ide

相關文章
相關標籤/搜索