Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with plugin
#4
(10-10-2019, 10:03 PM)carmen Wrote: Ofnuts--First: many, many thanks! Following your kind explanations, I have got the plugin installed and running. Maybe tomorrow I can post an example of its use (small fonts in maps / 'single path' fonts...)
Now, you say
Quote:Use the Apply button in the PDB browser to get a Python-acceptable version of the call copied to the Python console.
Well--although I have got Linux installed in an old laptop (unopened, alas! for months) I work chiefly in Win7, and my procedures browser doesn't include any gimp_..., but only gimp-... entries. I can only hope that a substitution of -/_ will cover most cases, it's one of those instance where I miss a cheat sheat!
Just discovered that the Apply button appears when one calls the PDB browser with phyton console opened.
The substitution works in all cases. The PDB browser is you reference because it contains all the help for the plugins you installed, assuming the other put relevant strings in the registration data.

(10-10-2019, 10:03 PM)carmen Wrote: New hitch: editing

Code:
import sys
sys.stderr = open('G:/Tests/Gimp_plug/python-fu-output.txt','a')
sys.stdout=sys.stderr # So that they both go to the same file
to

Code:
import sys
sys.stderr = open(os.path.devnull,'a')
made the plugin unaloadable:

Code:
Traceback (most recent call last):
  File "G:\GimpResources\plug-ins\group-text2path.py", line 15, in <module>
    sys.stderr = open(os.path.devnull,'a')
NameError: name 'os' is not defined
Is there an alternative, or just comment out the call to traceback for normal use?
Thanks, gracias, merci...

You have to do import os before you can use os.

Personallu, I start my scripts with:

Code:
debug='OFN_DEBUG' in os.environ

def trace(s):
    if debug:
        print s

And I use the  trace() instead of print in the code. trace() only prints something if the variable OFN_DEBUG is set in the environment, and this variable is set automatically in the terminal that is associated with my code editor.
Reply


Messages In This Thread
Help with plugin - by carmen - 10-10-2019, 05:33 PM
RE: Help with plugin - by Ofnuts - 10-10-2019, 08:36 PM
RE: Help with plugin - by carmen - 10-10-2019, 10:03 PM
RE: Help with plugin - by Ofnuts - 10-11-2019, 06:22 AM
RE: Help with plugin - by carmen - 10-11-2019, 05:24 PM

Forum Jump: