Changing class name causes process to 'hang'
Terry Reedy
tjreedy at udel.edu
Sat Mar 12 21:36:20 EST 2011
On 3/12/2011 7:18 PM, Tim Johnson wrote:
> * Terry Reedy<tjreedy at udel.edu> [110312 13:28]:
>> On 3/12/2011 2:53 PM, Tim Johnson wrote:
>>
>> Is 'cgilib' *your* wrapper of the cgi module, or from a third party.
> cgilib is my module. I use the cgi module as follows:
> ## code below
> import cgi
> self.form = cgi.FieldStorage(keep_blank_values=1)
> ## /code
And cgitools is a class therein?
>> Without seeing cgitools/cgirev, it is hard to say. Something like
>>
>> while True:
>> try:
>> x = cgitools()
>> break
>> except NameError
>> pass
>>
>> would produce the symptom ;-)
> Hmm! I'm unsure what you mean here, but
If the name 'cgitools' is used *somewhere*, not necessary in cgilib
itself, other than in the class header itself, but the resulting
NameError is *somehow* caught inside a retry loop, then your total
application would exhibit the symptom you describe ('hanging'). This
could happen if there is a bare 'except:' statement (these are not
recommended) that needs to be specific 'except SomeError:'.
> I did do something like this:
> ## code below
> if __name__=="__main__":
> import sys,traceback
> sys.stderr = sys.stdout ##
> try :
> print("Content-type: text/html\n")
> print("<pre>")
> cgi = CGI()
> print("here")
> print("CGI OUTPUT TEST")
> for i in range(cgi.len_path_parts()):
> print("path part # %d requested: %s" % (i,str(cgi[i])))
> except :
> traceback.print_exc()
> ## /code
> And I get
> CGI OUTPUT TEST
> path part # 0 requested: test
> path part # 1 requested: this
> Whether I use CGI or cgitools as the class name.
>
> But, if I use CGI as the class name and instantiate from a large application
> with numerous dependecies, the process hangs.
> The same happens if I 'alias' cgitools, as in
> class CGI(cgitools):
> pass
You mean you leave 'class cgitools()...' alone within cgilib and just
add that? That would discredit the theory above. What if you use a
different alias, like 'moretools'? Are you on an OS where 'cgi' and
'CGI' could get confused?
> It is as if some gremlin lives on my system and insists that I use
> the name `cgitools' and only the name `cgitools'. I'm sure
> this comes from a side effect somewhere in the process.
> thanks for the reply
--
Terry Jan Reedy
More information about the Python-list
mailing list