Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where does python debug output go?
#1
I'm trying to debug a python plugin on gimp 3.0.6 on Windows 11. I can get all the section of code to run in the python console, but nothing turns up in the plugin itself except the specified dialog.

I cannot find out where any message output goes. Is there any way of putting the equivalent of print() statements in the code and having it turn up on a console somewhere? I'm running it from the command line as gimp-3.0.exe --verbose.
Reply
#2
(6 hours ago)nmw01223 Wrote: I'm trying to debug a python plugin on gimp 3.0.6 on Windows 11. I can get all the section of code to run in the python console, but nothing turns up in the plugin itself except the specified dialog.

I cannot find out where any message output goes. Is there any way of putting the equivalent of print() statements in the code and having it turn up on a console somewhere? I'm running it from the command line as gimp-3.0.exe --verbose.

I'm not on Windows, but starting GIMP in a terminal should display your print() statements. Did you try to start with gimp-3.0.6.exe? gimp.3.0.exe might just be a shortcut (disclaimer: I'm not competent for that OS).
Reply
#3
Gimp-3.0.exe is definitely not a shortcut, its 6.8MB!

I think it's the executable. Actually there are three of exactly the same size: gimp.exe, gimp-3.exe and gimp-3.0.exe. The one the main start menu shortcut uses is gimp-3.exe, doesn't make any difference though which is used, print() statements do not seem to turn up anywhere visible that I can see.

UPDATE:

Ah, but Gimp.message() turns up in the error console. That's a start.

I now find that what is returned from file = config.get_property("...") when it was created with procedure.add_file_argument() is not a string as I thought, it's a GFile (or something), and file.get_path() doesn't produce the path as it does in the working plugin I'm looking at. Don't know why, but it's a start.
Reply
#4
The object returned from get_property() is apparently a Gio.File, which is some sort of abstraction of a file.

get_path() returns nothing useful (though Google AI help said it returned a readable path). get_uri() produced the folder in the URI form file:\\\c:\.... Since I need the folder path to build full paths to files from, all I could do was remove the scheme prefix using string replace(). I'm certain that isn't the way to do it, and it definitely isn't cross platform, but I haven't found anything better yet. Would be good if there was a method something like get_readable_name(), get_fullpath() or similar, but if there is I haven't found it yet.
Reply


Forum Jump: