commands.getoutput("touch /mytxt.txt")
x="hello"
commands.getoutput("echo x | cat >> /mytxt.txt".format(x))
I tried to run this code in python live interpreter , it runs perfectly ,data is inserted into the file. but when i put this code in python program it shows no such file and directory. but file mytxt gets created into the / folder
Here is your answer:
If you write python code and not a shell script, I guess you want to use python built-in functions to manage your files.
I just has a similar issue on a server with php code. I edited the files as root, but then the web server could not write to the file.
The issue is that Apache (or your web server) does not have read/write access. like as a Group owner to the file/folder
Setting the GROUP permission, and set the folder so the web server has full read/write access too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.