Differences between revisions 10 and 11
Revision 10 as of 2015-04-29 02:21:11
Size: 343
Editor: ChauLaroch
Comment:
Revision 11 as of 2015-04-29 09:11:14
Size: 1206
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
There is nothing to write about myself really.<<BR>><<BR>>
Great to be a part of py2exe.org.<<BR>><<BR>>
I just hope Im useful in one way here.<<BR>><<BR>>
<<BR>><<BR>>
Stop by my webpage - motorcycle Insurance St. Joseph, Mo. - [[http://www.yellowpages.com/saint-joseph-mo/mip/benchmark-insurance-agency-11249027|www.yellowpages.com]] -
A GTK application I made has unimported errors. I used the option 'windows', but the console window gets opened when getting an error.
And maybe a tip, when closing the program it should be optional whether or not it warns for errors.

Mark Baas <m.baas _at_ zarb.org>




You can always redirect where the errors go with the sys module.
sys.stderr = StringIO.StringIO() will redirect error messages to a string in your program that no one will ever see.

A better option is a log file, then they can see the errors if the want to but don't have to
sys.stderr = open("logfile.txt","w")

if you want to redirect print statements as well, point sys.stdout to some other file


To avoid runtime errors on closing the windows executable, it may help to suppress all output and
modify py2exe/boot_common.py to
<<BR>>
if sys.frozen == "windows_exe" :<<BR>>
    class Blackhole(object):<<BR>>
        softspace = 0<<BR>>
        def write(self, text):<<BR>>
            pass<<BR>>
    sys.stdout = Blackhole()<<BR>>
    sys.stderr = Blackhole()<<BR>>
    del Blackhole<<BR>>
del sys<<BR>>


[Added by timo (at) eda-solutions.de]


See StderrLog for more info on this subject.

A GTK application I made has unimported errors. I used the option 'windows', but the console window gets opened when getting an error. And maybe a tip, when closing the program it should be optional whether or not it warns for errors.

Mark Baas <m.baas _at_ zarb.org>

You can always redirect where the errors go with the sys module. sys.stderr = StringIO.StringIO() will redirect error messages to a string in your program that no one will ever see.

A better option is a log file, then they can see the errors if the want to but don't have to sys.stderr = open("logfile.txt","w")

if you want to redirect print statements as well, point sys.stdout to some other file

To avoid runtime errors on closing the windows executable, it may help to suppress all output and modify py2exe/boot_common.py to
if sys.frozen == "windows_exe" :

  • class Blackhole(object):

    • softspace = 0
      def write(self, text):

      • pass

    sys.stdout = Blackhole()
    sys.stderr = Blackhole()
    del Blackhole

del sys

[Added by timo (at) eda-solutions.de]

See StderrLog for more info on this subject.

GuiApps (last edited 2015-04-29 09:11:14 by JimmyRetzlaff)