首页 > 其他 > 详细

subprocess execv() arg 2 must contain only strings

时间:2020-07-07 10:55:41      阅读:67      评论:0      收藏:0      [点我收藏+]
subprocess 调用的cmd中含有中文,如下
cmd="\cp -f %s %s"%(x, y),y是前台传入的中文参数
调用Popen导致如下错误:
execv() arg 2 must contain only strings

如下修改:
subprocess.Popen(cmd.encode(‘utf-8‘), shell=True)

subprocess execv() arg 2 must contain only strings

原文:https://blog.51cto.com/liuanhf/2509039

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!