From: Werner F. B. <wer...@fr...> - 2008-08-16 07:16:59
|
Steve, Can we do this on the py2exe list, as there might be others being able to help better then I can and that this stays in the archive for others to learn from too. Steve Freedenburg wrote: > Werner, > I put a plethora of print statements all over the two functions. > I'll put line numbers in the code so you can reference better But you are just printing some text instead the content of the variable which might help to understand what is going wrong. So, change the print statements as follows. > > 1 def ProcessLogMore(self): > 2 LR = linecache.getline(self.LogPath, self.CurrentLineCount) > 3 print 'Reading the current line of text from log' print LR or print 'LR: %s' % LR > 4 LineRead = LR[self.CharStrip:] > 5 print 'Stripping time and date stamp.' print LineRead or print 'LineRead: %s' % LineRead > 6 for ContSetting in self.ContSettings: print ContSetting or print 'ContSetting: %s' % ContSetting Werner > 7 if LineRead.find(ContSetting['SearchString1']) >=0: > 8 print 'Trying to match text with first search string' > 9 ContSetting['TC'].WriteText(LineRead) > 10 try: > 11 ContSetting['Sound1Play'].Play(wx.SOUND_ASYNC) > 12 except Exception: > 13 pass > 14 > 15 try: > 16 if LineRead.find(ContSetting['SearchString2']) >=0: > 17 print 'Trying to match text with second search > string' > 18 ContSetting['TC'].WriteText(LineRead) > 19 try: > 20 ContSetting['Sound1Play'].Play(wx.SOUND_ASYNC) > 21 except Exception: > 22 pass > 23 except: > 24 pass > 25 > 26 linecache.clearcache() > 27 print 'Clearing line from cache' > > Line 5 happens. Nothing in the for loop prints. I have two > "ContSetting" dictionaries in self.ContSettings right now, so > I would expect to see line 8 and line 17 printed twice, > than line 27 printed once, wash, rinse, repeat. I do not. > > In the previous program I used a for loop also. > > for i in xrange (1,7): And did an if statement similar to line > 7, and the exact same thing happened. The for loop was > skipped. > > Do I maybe need to add some includes to the Py2Exe may > be overlooking? some of my imports? > > Anyhow, enough for the momment, going to try and figure out > the wx.Python demo thing you mentioned. > > Steve > > ----- Original Message ----- From: "Werner F. Bruhin" > <wer...@fr...> > To: <py2...@li...> > Sent: Friday, 15 August, 2008 11:20 > Subject: Re: [Py2exe-users] Py2Exe or Gui2Exe breaking py. > > >> Hi Steve, >> >> Lets keep it on the list. >> >> Steve Freedenburg wrote: >>> More information. >>> >>> 1> No the EXE does not crash. In all intents and purposes it "looks" >>> like everything >>> is ok. >>> >>> 2> The EXE does not create an error log at any point of running the >>> program. Like >>> if I had removed the icon file from the directory the program is in, >>> it would a text >>> file with the trace back saying a bunch of things about missing img, >>> or what ever. >>> None of that. >>> >>> 3> The dictionary isn't empty. I know this because everything the >>> program needs to >>> work is stored in that dictionary. >> I too know it very often that it is that way for my program. BUT, then >> I step back and start debugging, either using the Boa debugger, or the >> wxPython inspection tool or print statements and all on a sudden >> something which should not happen is actually happing. I.e. I "know" >> that the computer is always right, i.e. it does what we tell him/it to >> do, but we are sometimes wrong, because what we think we tell him/it is >> not quite what we actually do tell him/it ;-) . >>> The user goes through a dialog to set up all >>> the things like the path and file name of the log file to be used, >>> colors, fonts, sound >>> files to be played. And most importantly when the program first >>> loads, it creates >>> menu items and builds frames and other widgets based on the values and >>> quantities >>> of values in that dictionary by pickling / unplickling them. So i >>> wouldn't have >>> the things needed in the program to know it wasn't working if the >>> dictionary was >>> empty. Does that make sense? >>> >>> I'm sure it is possible an anomoly occurs where the dictionary key / >>> value is empty >>> just for the search strings, hard to swallow though. >>> >>> 4> The two versions of the program are galactically diferent. The one >>> thing that >>> is the same is that the data is pickled and unpickled but both >>> programs worked exactly >>> the same, and fail in exactly the same spot in the EXE but the PY file >>> doesn't have >>> a problem. >>> >>> 5> The log path is set in the program configuration, it's not hard >>> coded. Everything >>> is set in the configuration figuration. Even the labels to the frames >>> that have the >>> text control widgets in them, and there colors and fonts etc. >> >> I then see two ways forward for you. >> >> 1. Include the wxPython Inspection mixin into your application. Press >> F6 in the wxPython demo to see what it gives you, this will allow you to >> inspect variables etc in your running application. In the wxPython demo >> Memo.py module around line 2023 you can see one way on how to use it. >> Or look at the end of wx.lib.mixins.inspection.py for an alternative >> approach. >> >> 2. Put print statements in, i.e. >>>>> >>>>> def ProcessLogMore(self): >>>>> LR = linecache.getline(self.LogPath, self.CurrentLineCount) >>>>> LineRead = LR[self.CharStrip:] >> print LineRead >>>>> self.TVStatusBar.SetStatusText('Matching', 0) >>>>> for ContSetting in self.ContSettings: >> print ContSetting >> >> etc. >> >> Werner >> >> ------------------------------------------------------------------------- >> >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win >> great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Py2exe-users mailing list >> Py2...@li... >> https://lists.sourceforge.net/lists/listinfo/py2exe-users > > > |