Python subprocess.Popen更改文件夹权限?

时间:2012-05-04 05:49:16

标签: python ubuntu

在Ubuntu中,我使用subprocess.Popen来调用可执行文件,这会将一些输出文件保存在服务器的硬盘上。代码已在本地计算机上成功测试。但是,它在服务器上不起作用。我的代码如下:

#create a new folder. The permission is drwxrwx both locally and on the server end
os.makedirs(folder)

#copy the executable file to this folder. The permission is drwxrwx both locally and on the server end after copy
shutil.copy("a.exe", folder)

#call this exe file. The permission is drwxrwx locally but changed to drwxr-x on the server end. Since I do not have the write permit, my code fails.
subprocess.Popen("a.exe")

我不确定为什么子进程会在服务器端更改我的文件夹权限。那么有人能给我一些建议吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

尝试:

subprocess.Popen("a.exe", shell=True)