Python script unable to write file to same directory
I have a python script at in public_html/dev.cmrd.space/cgi-bin/py-test/printer.py. I have had success doing a simple print and getting the results of that. However, when I try to have it write a file in the same directory, the call to script fails.The file itself is currently set to permissions 0777, as is its parent directory.
I know the script works fine on my local machine, and there is nothing functionally different about the script on the server. Do you have an idea as to why the script can not create a new file?
I know the script works fine on my local machine, and there is nothing functionally different about the script on the server. Do you have an idea as to why the script can not create a new file?
Hello,
Thanks for the question about the Python script not writing to the same directory. This is most likely a security issue. Check out this article about 500 errors and using 777 permissions: 500 Internal Server Error. Try changing the permissions and you should be able to get the code to work. When you're coding on a hosting server, there will be security issues that you won't see on a local computer. If you have any further questions, please let us know.
Kindest regards,
Arnel C.