Re: [Gimp-user] Debugging register function for registration of a python plugin under Windows XP



On 15/06/14 23:45, SeldomNeedy wrote:
import sys
sys.stderr = open("C:\\tmp\\errs.txt",'a')

This will cause the python environment to show some otherwise-hidden startup and
register-registration errors by outputting / printing them to the specified
location. The example I saw used mode 'a' to append errors, rather than
overwrite. Doing this allowed me to spot a mistake I was making.

In addition, one can also do

import sys
sys.stout = open("C:\\"tmp\\msgs.txt",'a')

if it's more convenient to receive output this way.


Actually you can have both outputs to the same file:

|sys.stderr = open('C:/temp/python-fu-output.txt','a')
sys.stdout=sys.stderr

And of course, when done you can keep the print instructions if you reroute everything to the bit-bucket:
|
|import os
sys.stderr = open(os.path.devnull,'a')|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]