Changing class name causes process to 'hang'

Terry Reedy tjreedy at udel.edu
Sat Mar 12 17:21:48 EST 2011


On 3/12/2011 2:53 PM, Tim Johnson wrote:
> I'm using Python 2.6.5 on ubuntu 10.04 32-bit.
> My issue however, is with a code base that goes back to 2002,
> which at that time was 1.5~ or so.
>
> I have been since that time using my own cgi module which in turn,
> uses the python standard `cgi' module.
>
> The object instantiation has looked something like this:
> ## code below
> cgi = cgilib.cgitools()
> ## /code

Is 'cgilib' *your* wrapper of the cgi module, or from a third party.

> I choose to create a new cgi module by copying `cgilib' as `cgirev'
> and renamed the `cgitools' to `Cgi' so that the instantiation
> looked like
> ## code below
> cgi = cgirev.Cgi()
> ## /code
>
> And ran into problems, the cgi script would run almost to
> completion, but acted like it lost track of the stack at some point
> and would not terminate.
>
> I deleted all .pyc files associated with any file that might be a
> dependency. That did not solve the problem.  After scratching my head
> and swearing for a couple of hours, I changed the name of the `Cgi'
> class back to `cgitools' and everything worked.
>
> ## code below
> cgi = cgirev.Cgi()
> ## /code
>
> 1)This is a mystery to me that may likely hide other issues that may
> come to bite me later.
>
> 2)I don't want to be stuck with the `cgitools' classname.
>
> I have never used a debugger with python. Never had to, python's
> error messages have always been my friend and mentor, but in this
> case there are no error messages.

Without seeing cgitools/cgirev, it is hard to say. Something like

while True:
   try:
     x = cgitools()
     break
   except NameError
     pass

would produce the symptom ;-)

-- 
Terry Jan Reedy




More information about the Python-list mailing list