1
我正在使用python中的子进程来更改我在linux上当前目录中新建文件的权限。Python子进程无效的模式错误使用shlex的chmod
当我运行在命令行下,它按预期工作:
chmod 664 `find /path/path -type f`
我想通过以下来实现这在我的Python代码:
perms = "chmod 664 `find /path/path -type f`"
command = shlex.split(perms)
subprocess.call(command)
其中command是如下:
['chmod', '664', '`find', '/path/path', '-type', 'f`']
我在我的控制台中得到以下错误:
chmod: invalid mode: `-type'
这是否与特殊字符有关?
感谢