Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Picloud(AMAZON EC2服务器)上更改子进程文件夹权限?_Python_Windows_Amazon Ec2_Subprocess_Administrator - Fatal编程技术网

Python 在Picloud(AMAZON EC2服务器)上更改子进程文件夹权限?

Python 在Picloud(AMAZON EC2服务器)上更改子进程文件夹权限?,python,windows,amazon-ec2,subprocess,administrator,Python,Windows,Amazon Ec2,Subprocess,Administrator,在Ubuntu中,我使用subprocess.Popen调用一个可执行文件,它会将一些输出文件保存在服务器(Picloud)的硬盘上。该代码已在本地Ubuntu机器上成功测试。但是,它在服务器上不起作用。我的方法如下: #create a new folder. #The permission is drwxrwx--- both locally and on the server end os.makedirs(folder) #copy the executable file to th

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

#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")
>>>OSError: [errno 13] permission denied.
我不确定为什么子进程会更改服务器端的“我的文件夹”权限。因此,我尝试使用
sudo
模式: subprocess.Popen(“sudo”、“a.exe”) 正如我所料,此代码仅在本地工作

那个么,有人能给我一些帮助,说明为什么子进程会删除我的写权限吗


谢谢

在windows中,您可以使用以下命令运行它:

subprocess.Popen("runas /user:Admin a.exe")

这在Windows上工作吗?因为至少在Linux上,
subprocess.Popen
的第一个参数需要是一个列表……没有在Windows上测试过它。该代码在本地ubuntu机器上运行,但在服务器端同样的代码失败。