Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file_png_save2 gives Permission Denied error, but can save through File menu
#3
(04-29-2023, 10:04 PM)Ofnuts Wrote: Nothing obvious, so:
  • Check the system security log, perhaps the python interpreter is blacklisted and it (or its children) are not allowed to write to disk.
  • If you catch the exception and print the exception message, you could have more info (see here for some hints)
  • The OneDrive directory could have a special status, and this isn't difficult to check by writing elsewhere.
  • I assume that MyId is replaced by the adequate username
  • Your first name parameter has no extension, so I wonder what the real name is and what it does
Also:
  • You can avoid the double \\ by using r-strings: r"C:\Users\MyID\OneDrive\Pictures\ScriptTest\", but forward slashes also work on Windows: "C:/Users/MyID/OneDrive/Pictures/ScriptTest/"
  • The os.path module has a join method to create correct paths from directories and file names.

Thanks for the help.

There was nothing related to the Python interpreter in the security log.
I tried having it write to another disk (E://ScriptText/test1), but got the same error.
You're right about the MyID.
I caught the exception and this was the text:

Calling error for procedure 'file-png-save2':
Could not open 'C:/Users/MyID/OneDrive/Pictures/ScriptTest/test1' for writing: Permission denied

I checked the file permissions for the ScriptText and test1 folders, and they're both able to be written to.
I tried running the Python interpreter as Administrator, but still got that error.
Reply


Messages In This Thread
RE: file_png_save2 gives Permission Denied error, but can save through File menu - by Leonide - 04-30-2023, 02:19 AM

Forum Jump: