py2exe and window with info about error

Discussion in 'Python' started by Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=, Oct 29, 2004.

  1. 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
     
    Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=, Oct 29, 2004
    #1
    1. Advertising

  2. Krzysztof Ksi¹¿ek <> wrote:
    > 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
     
    Josiah Carlson, Oct 30, 2004
    #2
    1. Advertising

  3. On 2004-10-30 03:33:28 Josiah Carlson wrote:


    > 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
     
    Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=, Oct 30, 2004
    #3
  4. Krzysztof Ksi¹¿ek <> wrote:
    >
    > On 2004-10-30 03:33:28 Josiah Carlson wrote:
    > > 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')


    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
     
    Josiah Carlson, Oct 30, 2004
    #4
  5. On 2004-10-30 17:15:55 Josiah Carlson wrote:

    > 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
     
    Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=, Oct 30, 2004
    #5
  6. Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=

    steen Guest

    Krzysztof Książek wrote:
    > 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
     
    steen, Oct 30, 2004
    #6
  7. On 2004-10-30 23:55:56 steen wrote:

    > 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
     
    Krzysztof =?iso-8859-2?Q?Ksi=B1=BFek?=, Oct 31, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alvin Bruney

    Re: Send Info from Window to Window

    Alvin Bruney, Aug 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    376
    Alvin Bruney
    Aug 24, 2003
  2. F. GEIGER
    Replies:
    0
    Views:
    918
    F. GEIGER
    Aug 16, 2004
  3. python
    Replies:
    3
    Views:
    1,801
    Simon Brunning
    May 22, 2006
  4. Chris Spencer

    Re: [Py2exe-users] py2exe 0.6.9 released

    Chris Spencer, Nov 17, 2008, in forum: Python
    Replies:
    3
    Views:
    574
    Pascal
    Dec 8, 2008
  5. Mark Hammond

    RE: [Py2exe-users] py2exe 0.6.9 released

    Mark Hammond, Nov 17, 2008, in forum: Python
    Replies:
    0
    Views:
    459
    Mark Hammond
    Nov 17, 2008
Loading...

Share This Page