Posts: 5
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
12-06-2020, 10:55 AM
(This post was last modified: 12-06-2020, 10:56 AM by ghoul fool.)
Hi, first time caller - so go easy on me.
I'm running GIMP 2.10.18 on Win7, trying to run a script from the command line using:
Code:
cd %~dp0
"D:\GIMP2\bin\gimp-2.10.exe" -idfs --batch-interpreter python-fu-eval -b "import sys;sys.path=['.']+sys.path;import myscript;myscript.run('./images')" -b "pdb.gimp_quit(1)"
The error I get is simply:
Code:
batch command experienced an execution error
(Type any character to close this window)
I tried to make the errors verbose with
Code:
sys.stderr = open('D:/temp/python-fu-output.txt','a')
sys.stdout=sys.stderr
...only to no avail.
I'm used to running and writing scripts for Photoshop so this is all new to me. Thanks for any help.
Posts: 7,132
Threads: 155
Joined: Oct 2016
Reputation:
1,003
Operating system(s):
Gimp version: 2.10
I will bump this up incase it gets forgotten Personally I avoid using Gimp on command line, using ImageMagick or Gimp with GUI BIMP instead.
However these might help until one of the clever guys comes along.
This I have bookmarked, a post from Ofnuts: https://stackoverflow.com/questions/4443...mmand-line
and this one more advice http://gimpchat.com/viewtopic.php?f=9&t=15024
There might be something there that helps.
Posts: 5
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
12-07-2020, 12:11 PM
(This post was last modified: 12-07-2020, 01:32 PM by ghoul fool.)
I'm tied to doing this as a Gimp Script (which was working on a Mac earlier in the year).
Using Xeniod's example on Stackoverflow I realised that my batch file needed the /d to run from the same file as the batch file.
cd /d %~dp0
However, it now says:
batch command executed successfully
without processing (photocopy/cartoon filter) to the image.
Further investigations suggest that the folder (from which the batch file and image live) and sub folder are being changed to "read only"
Posts: 5
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
(12-07-2020, 12:11 PM)ghoul fool Wrote: I'm tied to doing this as a Gimp Script (which was working on a Mac earlier in the year).
Using Xeniod's example on Stackoverflow I realised that my batch file needed the /d to run from the same file as the batch file.
cd /d %~dp0
However, it now says:
batch command executed successfully
without processing (photocopy/cartoon filter) to the image.
Posts: 6,340
Threads: 272
Joined: Oct 2016
Reputation:
563
Operating system(s):
Gimp version: 2.10
12-08-2020, 07:28 AM
(This post was last modified: 12-08-2020, 07:33 AM by Ofnuts.)
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.
Posts: 5
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
12-08-2020, 09:13 AM
(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! )
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.
Posts: 6,340
Threads: 272
Joined: Oct 2016
Reputation:
563
Operating system(s):
Gimp version: 2.10
(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! )
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
Posts: 5
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
(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! )
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
Yes, this is about the second time in a loooong time that I regret using a Windows based box.
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
Each time so I could at least work out how far it go.
Got there in there in the end
|