#1
  1. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154

    Inevitable Error?


    At first, my program had been working fine, about 2 hours later when I tried to run it, even after no code had been changed, I started receiving an error. Or problem I should say. No error shows up, the program wil not open and the Python Interpreter crashed when it tries to run it. No matter what I do with the code that seems to be the problem, it never fixed the main problem. First, I have a function:
    Code:
    def RunProcess(*process):
        """ Runs multiple processes as separate threads """
        for p in process: Timer(0, process).start()
    This function is outside of my main class (which is used for wxPython). I use this to call functions that are inside of the class as separate threads. next, I have the following code:
    Code:
    self.tos_text = wxTextCtrl(self, -1, '', wxPoint(595, 0), wxSize(430, 500), wxTE_MULTILINE | wxTE_READONLY)
            self.tos_text.SetBackgroundColour('BLACK'); self.tos_text.SetForegroundColour('WHITE')
            self.tos_text.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, False, 'Lucida Console'))
    This create a needed text control for my application. before this set of code, I have another line:
    Code:
    RunProcess(self.ConnectBnetFTP(), self.DownloadTOS())
    This line calls two different functions, the second function, DownloadTOS() at one point uses the RunProcess() function to call yet another function, the function it calls uses self.tos_text.
    At this time, self.tos_text is used to append text onto it. For some reason this does not happen and Python tells me that the variable does not even exist. After a few times of re-trying the code, the Interpreter no longer operates. here is the final function I am referring to:
    Code:
    def StartDataArrival(self):
            while(1):
                data = bnet_ftp.recv(1024)
                if(TOS_USA in data): pass
                else: self.AddText(self.tos_text, data, showtime=False)
                self.tos_text.SetInsertionPoint(0)
    It has *never* been changed and it has worked before.
    Now, If I remove all of this code, except for the code that declared self.tos_text. And I append text to self.tos_text, it works perfectly fine. But when using all these functions, it doesn't. I'm beginning to wonder if the Timer() function is having something to do with it. However it worked fine before.

    I will continue to look for a solution, if I find one, I'll edit my post .

    Sorry this post had to be so long for any of you who decide to read it, but by doing this I won't (or shouldn't) have to answer to many questions.

    Note: If anyone needs the source to the whole program, I'll be glad to send it to you.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2004
    Location
    There where the rabbits jump
    Posts
    556
    Rep Power
    11
    Well I am not sure about this but sometimes threads and loops don't fit for example by me I had an endless loop and then it always crashed because it went on and on???

    BUt try to look over your threads and loop make holes so that the loop can be shut down in case...
    Those people who think they know everything are a great annoyance to those of us who do.
  4. #3
  5. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Well, looping or threads are no longer the problem. I barely changed my code, and now it tells me that self.tos_text does not exist. For anyone who wants to look at the code, here is the file.
    Attached Files

IMN logo majestic logo threadwatch logo seochat tools logo