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
#1
I'm trying to write a script to automate some things for a project I'm working on, and one of the steps is saving a file as a png. I'm using file_png_save2. When running the script, it errors out with a "Permission Denied" message. However, I can save files to the same folder with no issue if I go through File->Export.
I'm running Gimp 2.10 on Windows 11. Here is the code for the script so far:

#!/usr/bin/python
 
from gimpfu import *

baseURL = "C:\\Users\\MyID\\OneDrive\\Pictures\\ScriptTest\\"
 
def char_img_164(image, drawable, imgid):
    pdb.gimp_edit_copy(image.layers[0])
    newImg = pdb.gimp_edit_paste_as_new_image()
    pdb.gimp_image_scale(newImg, 164, 164)
    dispImg = pdb.gimp_display_new(newImg)
    layer = pdb.gimp_image_merge_visible_layers(newImg, CLIP_TO_IMAGE)
    pdb.file_png_save2(newImg, layer, baseURL + "test1",imgid+".png",0,9,0,0,0,0,0,0,0)
 
register(
   "char_img_164",
   "Image test",
   "Test script",
   "MyID",
   "MyID",
   "2023",
   "<Image>/Image/ScriptTest/IMG164",
   "*",
   [
       (PF_STRING, "imgid", "Enter ID", "hello")
       ],
   [],
   char_img_164)
 
main()
Reply


Messages In This Thread
file_png_save2 gives Permission Denied error, but can save through File menu - by Leonide - 04-29-2023, 09:15 PM

Forum Jump: