![](/img/trans.png)
[英]What are the steps involved in running the same python script in parallel in amazon ec2 or picloud
[英]Subprocess change folder permission on Picloud (an AMAZON EC2 server)?
在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")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.