py2exe and window with info about error

  • Thread starter Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=
  • Start date
K

Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=

Hi!

As almost totally newbe, I have written a simple script and I'm proud of
it ;-) It connects to ftp server and uploads some files. Kind of backup.
I've compiled it with py2exe and put it in autostart.
When something is wrong (in example, I'm not connected to the net), it
opens a window with some information about error and exact location
where I can find log.
How can I get rid of this window? I'd like to have a log file, but I
don't want to see a popup during XP startup.

I have no idea if it is important, but here is my setup.py:

from distutils.core import setup
import py2exe
setup(windows=["script.py"])


Thanks in advance for your help.

Regards,
Krzysztof Ksiazek
 
J

Josiah Carlson

Krzysztof Ksi¹¿ek said:
As almost totally newbe, I have written a simple script and I'm proud of
it ;-) It connects to ftp server and uploads some files. Kind of backup.
I've compiled it with py2exe and put it in autostart.
When something is wrong (in example, I'm not connected to the net), it
opens a window with some information about error and exact location
where I can find log.
How can I get rid of this window? I'd like to have a log file, but I
don't want to see a popup during XP startup.

[snip setup.py]

So what you are saying is that you wrote an application that is run
during startup, and on failure, you get a dialog that pops up to tell
you that a failure has occurred, and you want to get rid of the dialog.

First questions: how is this dialog being brought up? Are you making it
happen with some sort of GUI toolkit (like wxPython or tk)? Is it
automatically happening if your script raises an exception? Give more
information.


- Josiah
 
K

Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=

First questions: how is this dialog being brought up? Are you making it
happen with some sort of GUI toolkit (like wxPython or tk)?

No. I'm not using any GUI toolkit. It does not have any graphical
elements. That's why I don't like to have that error window.
Is it
automatically happening if your script raises an exception?

I think that is the reason. Here is the example of info from log file.
It looks for me like standard exception handling. Since it can't write
it to console, it writes the output to log file and and shows the
information window.

Traceback (most recent call last):
File "test-programu.py", line 3, in ?
File "ftplib.pyc", line 107, in __init__
File "ftplib.pyc", line 117, in connect
socket.gaierror: (7, 'getaddrinfo failed')

Regards,
Krzysztof Ksiazek
 
J

Josiah Carlson

Krzysztof Ksi¹¿ek said:
I think that is the reason. Here is the example of info from log file.
It looks for me like standard exception handling. Since it can't write
it to console, it writes the output to log file and and shows the
information window.

Traceback (most recent call last):
File "test-programu.py", line 3, in ?
File "ftplib.pyc", line 107, in __init__
File "ftplib.pyc", line 117, in connect
socket.gaierror: (7, 'getaddrinfo failed')

How is your script being run? Is it placed in one of the registry
locations:
HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Run
HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/Run
HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/RunServices
HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/RunServices

Or is it run via shortcut from your Startup program group? Or some
other method.

How is it being run?

- Josiah
 
K

Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=

How is your script being run? Is it placed in one of the registry
locations:
HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

It is located in that registry key.

Greetings,
Krzysztof Ksiazek
 
S

steen

Krzysztof said:
Hi!

As almost totally newbe, I have written a simple script and I'm proud of
it ;-) It connects to ftp server and uploads some files. Kind of backup.
I've compiled it with py2exe and put it in autostart.
When something is wrong (in example, I'm not connected to the net), it
opens a window with some information about error and exact location
where I can find log.

I believe the best solution would be to catch the exception. Then you
wont get any error messages at all :)
I have never used ftplib so I cant provide sample code but you should
probably put a try: except: around your connect command. Then when an
exception is raised you can take apropriate action like logging to a
file or just ignore it.
How can I get rid of this window? I'd like to have a log file, but I
don't want to see a popup during XP startup.

I have no idea if it is important, but here is my setup.py:

from distutils.core import setup
import py2exe
setup(windows=["script.py"])

Thanks in advance for your help.

Regards,
Krzysztof Ksiazek
 
K

Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=

I believe the best solution would be to catch the exception. Then you
wont get any error messages at all :)

Thx. It works.

Regards,
Krzysztof Ksiazek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top