All problems fixed with your help! thanks a lot!

On 5/11/07, Thomas Heller < theller@ctypes.org> wrote:
Michel Peterson schrieb:
> I have written an application that uses threading to process files in a
> separate thread, another thread to monitor a directory and the third is the
> main thread. The thing is that when executed directly from the source the
> application works as expected, but when executed from the py2exe generated
> executable, those threads work in a random manner leading to non working
> threads at random.
>
> 1) Is there any incompatibility issue between py2exe and threading module?
>
> 2) Can changing windows to console do a difference? (
> http://mail.python.org/pipermail/python-list/2004-August/277570.html )

One difference between a py2exe frozen exe and the Python script is that
the exe usually is built with 'windows=...', and the Python script
is usually run with python.exe.  The windows (no-console) program has
its stdin, stdout, stderr handles closed.  In other words, writing something
to the closed handles will raise an error.  This, in turn, would by default
try to print a traceback to the closed stderr channel, which will not work.

As a workaround, a no-console py2exe assignes 'writeable objects' to sys.stderr and sys.stdout.
sys.stdout simply ignores everything that is written to it, sys.stderr will write to
a logfile and display a message box when the program exists. The code that does this
is in Lib\site-packages\py2exe\boot_common.py; so you can inspect or change it if you want.

Maybe this does not work in your case, for whatever reasons.

You should try two things:

1. Build a console exe, it does not have the above problems.
2. Test your script with pythonw.exe instead of python.exe.  Pythonw.exe
also runs with stdin, stderr, stdout closed; so it may be somewhat tricky
to get tracebacks, see above.

Thomas


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users