Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GIMP python script from command line
#8
(12-08-2020, 11:38 PM)Ofnuts Wrote:
(12-08-2020, 09:13 AM)ghoul fool Wrote:
(12-08-2020, 07:28 AM)Ofnuts Wrote: Do you get any output from the Python code (print statements)? Otherwise see here for some hints.

PS: I don't see how Gimp or the Python code could change the status of the directory. OTOH IIRC on recent Windows unknown apps are not always allowed to write files, so maybe you need to give Gimp some privileges.

I've reinstalled as Admin, and I'm able to create a script create a folder (yay!  Big Grin)

Code:
def make_dir():

 mainDir = "D:\\temp\\images"
 folder = "spoon"
 fname = os.path.join(mainDir, folder)

 # make a directory
 os.mkdir(fname)

 msg = "Make a " + folder + " directory!! " + "\n"
 gimp.message(msg)

Now the main thing is trying to work out
(a) how to get some sort of error log feedback and (b) which line/s doesn't it like.

You can just type python yourscript in a command line and python will show the most blatant errors (unbalanced quotes/parens, indentation errors, etc...). If you don't get any of these, then you can use the trick expounded in the tutorial thread above to reroute all Python output to file.

Of course, all this is  a lot easier on Linux Big Grin


Yes, this is about the second time in a loooong time that I regret using a Windows based box. Smile

I also figured out about running a GIMP python script as "normal" python one - to check for errors. V. useful.

I also front a function to print statements as well as 
Code:
gimp.message(text)

Each time so I could at least work out how far it go.
Got there in there in the end Smile
Reply


Messages In This Thread
RE: GIMP python script from command line - by ghoul fool - 12-11-2020, 02:07 PM

Forum Jump: