ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
[wxpython-users] Why does py work, but EXE not?
by Steve Freedenburg other posts by this author
Jul 18 2008 9:37AM messages near this date
Re: [wxpython-users] remove image of a tree item | Re: [wxpython-users] Why does py work, but EXE not?
First off, I tried the Py2Exe mailing list, but have only seen 1 new e-mail 
since I left mine.  So I
am guessing that mailing list isn't very active.

Ok the EXE, does "work" in the sense that the GUI loads, all the widgets 
load, and look correct.
Everything "works" except it seems that part of the program is getting 
skipped over.  I've linked
the code that is getting skipped over.  There are no traceback errors being 
reported at all in the
log file the EXE generates.  I even fouled up the code to see if it would 
even generate a log of
errors and recompiled it.  It does in fact report errors.

The script itself works, I've tested it for hours.  You may remember me 
asking about, wx.Timers,
which is better, slice or split, and pretty much everything I've posted 
about is what is getting skipped.
Maybe skipped isn't what is happening, but that is what it looks like.

I'll copy the e-mail I send to the Py2Exe mailing list:

The modules I imported are (I'll comment the ones that are my own or may not 
be popular):

import wx.animate   # for animated GIF files (splashscreen uses one)
import chat_bmp     # embedded bmp
import config_bmp   # embedded bmp
import load_bmp     # embedded bmp
import exit_bmp      # embedded bmp
import start_bmp     # embedded bmp
import help_bmp     # embedded bmp
import info_bmp      # embedded bmp
import stop_bmp     # embedded bmp
import wx
import os
import sys
import time
import linecache
import pickle
import string
import wx.lib.filebrowsebutton
import wx.lib.dialogs
import wx.lib.colourselect as CSel
from wx.lib.wordwrap import wordwrap
from wx.lib.pubsub import Publisher    # MVC for inter-frame write texting.

The quick description of what the program does:

User picks a log file be read.  The program takes custom search
strings and sorts log entries based on those search string and places
the entries into a frame with a text control widget via writetext.
It does this by using Publisher() from wx.lib.pubsub.

Most of the program is a GUI (wxPython) and user defining options
like the search string, frame label, fonts, colors, sounds.

The part that gets skipped over in the EXE is within an wx.Timer event.

The code that seems to be getting skipped is:

<CODE> 

    def FLCplus1(self):
        LR1 = linecache.getline(LogDirValue, CurrentLineCount)
        LineRead1 = LR1[FrontStripInt:]
        for i in range(1,7):
            if LineRead1.find(globals()['C%iSearchString'%i]) > =0:
                Publisher.sendMessage(('C%i'%i, 'message'), [LineRead1])
                CurrentTime = time.localtime(time.time())
                TimeStamp = time.strftime("%H:%M.%S", CurrentTime)
                self.MainFrameTextCtrl.WriteText('(' + TimeStamp + ')  ' + 
'Got match! Publishing...\n')

        CurrentTime = time.localtime(time.time())
        TimeStamp = time.strftime("%H:%M.%S", CurrentTime)
        self.MainFrameTextCtrl.WriteText('(' + TimeStamp + ')  ' + 'Done 
restarting...\n')
        linecache.clearcache()

</CODE> 

The code that calls FLCplus1() is this:

<CODE> 

    def ProcessLog(self, event):
        global FirstLineCount
        global CurrentLineCount
        CurrentLineCount = len(open(LogDirValue, 'rb').readlines())
        if CurrentLineCount == FirstLineCount:
            CurrentTime = time.localtime(time.time())
            TimeStamp = time.strftime("%H:%M.%S", CurrentTime)
            self.MainFrameTextCtrl.WriteText('(' + TimeStamp + ')  ' + 'Line 
count equal...\n')
            return
        elif CurrentLineCount >  FirstLineCount:
            CurrentTime = time.localtime(time.time())
            TimeStamp = time.strftime("%H:%M.%S", CurrentTime)
            self.MainFrameTextCtrl.WriteText('(' + TimeStamp + ')  ' + 'Line 
count greater...\n')
            self.FLCplus1()


</CODE> 

On a side note, the program does the above if / elif in ProcessLog() if the 
log file is
larger (as in lew log entries in the log file.)  It just seems to fly right 
by the FLCplus1()

In other words, the program reports in the textctrl every second.

Line count equal...
Line count equal...
Line count equal...
# new entry in log file happens and the program reports.
Line count greater...
# That line should be read and run through the for loop FCLplus1() if match 
it should report the following.
Got match! Publishing...
# Than report
Done restarting...

If there isn't a match it in the for loop it should leave out the "Got 
match! Publishing..." obvously.

Even when there should be a match in the EXE version it just says "Line 
count greater..." then
"Done restarting..."

In the py (as I said, but want to make sure it's understood) every thing 
works like clockwork.

Thanks, and if I'm becoming a pest, if you can help me fix this one, I'll be 
done with this project
and will promise not to start another one for a while and not bother you 
guys.

Steve




_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
Steve Freedenburg
Claxo
Steve Freedenburg
Steve Freedenburg
Josiah Carlson
Steve Freedenburg
Steve Freedenburg
Josiah Carlson
Mike Driscoll
Werner F. Bruhin

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved