[Tutor] debugging problem

Gregor Lingl glingl@aon.at
Mon, 12 Aug 2002 16:19:36 +0200


Watt III, Glenn schrieb:

>ok heres my problem i run the script for the first proram listed call
>coll.py it runs into an error that says
>	"Traceback (most recent call last):
>	  File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py",
>line 113, in ?
>	    mainAction()
>	  File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py",
>line 18, in mainAction
>	    email = backbone.reqField("email", "E-mail Address")
>	AttributeError: 'module' object has no attribute 'reqField'"
>however there is an atribute called reqField in the backbone module as
>you can see in the second program listed what am i doin wron as usual
>thanks for any help
>
>  
>
Strange case, I'm really curious what's going on. Only a ramark or two:
(see bottom of mail)

>
>	coll:
>#!/usr/local/bin/python
>
>
>import MySQLdb
>import cgi
>import sys
>import backboner    <---
>
this certainly is a typo in the mail

>
>
>cgiForm = cgi.FieldStorage()
>
>err = ""
>wrong = 0
>
>
>def mainAction():
>    global backbone
>
this global statement is superfluous, I think

>    email = backbone.reqField("email", "E-mail Address")
>
>
>
>	backbone:
>#!/usr/local/bin/python
>
>err = ""
>wrong = 0
>
>cgiForm = cgi.FieldStorage()
>
># A checker for any required fields input is the name of the cgi
>variable response is what the user sees if it gets thrown back
>
>
>def reqField(input, response):
>    global wrong
>    global err
>    if cgiForm.has_key(input):
>        input = cgiForm[input].value
>        return input
>    elif wrong == 1:
>        err = err + ', ' + response
>    else:
>        err = response
>        wrong = 1
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>  
>
	"Traceback (most recent call last):
	  File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py",
line 113, in ?
	    mainAction()
	  File "\\Bbserver4\test\admin\newdesign\papers\cgi\coll.py",
line 18, in mainAction
	    email = backbone.reqField("email", "E-mail Address")
	AttributeError: 'module' object has no attribute 'reqField'"
however there is an atribute called reqField in the backbone module as
you can see in the second program listed what am i doin wron as usual
thanks for any help

Apparently there are many lines in coll.py left out in this mail -
so these could contain some reassignment to backbone:

I could simulate your error-message:

 >>> import backbone
 >>> backbone
<module 'backbone' from 'I:\G\Python\Progs\backbone.py'>
 >>> import math
 >>> def ma():
    global backbone
    e = backbone.reqField("","")

   
 >>> backbone = math
 >>> ma()
Traceback (most recent call last):
  File "<pyshell#62>", line 1, in ?
    ma()
  File "<pyshell#60>", line 3, in ma
    e = backbone.reqField("","")
AttributeError: 'module' object has no attribute 'reqField'
 >>> backbone
<module 'math' (built-in)>
 >>>

So, if you have a look at backbone afte the error-message has occured,
maybe you will get a clue ....

Gregor

Let us know, what turned out to be the cause ...