500 Internal error
Server got itself in trouble
Traceback (most recent call last):
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py", line 271, in run
main()
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py", line 502, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r425-py2.4.egg/turbogears/controllers.py", line 242, in newfunc
html, *args, **kw)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r425-py2.4.egg/turbogears/database.py", line 189, in run_with_transaction
retval = func(*args, **kw)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r425-py2.4.egg/turbogears/controllers.py", line 262, in _execute_func
return _process_output(tg_format, output, html)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r425-py2.4.egg/turbogears/controllers.py", line 64, in _process_output
output = view.render(output, tg_format, template=template)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r425-py2.4.egg/turbogears/view.py", line 56, in render
return engine.render(info, format, fragment, template)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r425-py2.4.egg/turbogears/kidsupport.py", line 141, in render
return t.serialize(encoding=self.defaultencoding, output=format, fragment=fragment)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 232, in serialize
return serializer.serialize(self, encoding, fragment)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py", line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py", line 316, in generate
stream = iter(stream)
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 257, in __iter__
return iter(self.transform())
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 312, in transform
stream = self.pull()
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 271, in pull
self.initialize()
File "/home/jmjones/svn/home/pppweb/trunk/pppwebproject/tg/pppweb/pppweb/templates/view_cart.py", line 19, in initialize
File "/home/jmjones/svn/home/pppweb/trunk/pppwebproject/tg/pppweb/pppweb/templates/master.py", line 21, in initialize
TypeError: 'NoneType' object is not callable
This is a huge pain to debug because .... how can I get at what's going
on? I've tried a suggestion someone posted here of dropping into
IPython through an IPShellEmbed() call. I can call IPShellEmbed() from
within the controller and it shows me what's going on inside the
controller. I've put the same thing in the offending template, but if
the error is occurring inside the template, it never gets called.
I guess I could look at templates/master.py .... oh, that's right - it
doesn't exist. I just googled and didn't find a flag to turn on
generation of .py files from Kid. If someone knows how, I'd appreciate
some insite. I guess I'm about to dig into kid/__init__.py to see if I
can track down more of what's going on... Just thought I'd take a
moment to whine while it's fresh on my frustration list.
- jmj
I guess I could look at templates/master.py .... oh, that's right - it
doesn't exist.  I just googled and didn't find a flag to turn on
generation of .py files from Kid.  If someone knows how, I'd appreciate
some insite.  I guess I'm about to dig into kid/__init__.py to see if I
can track down more of what's going on...  Just thought I'd take a
moment to whine while it's fresh on my frustration list.
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 314, in transform
By default, the `pull` method is called to obtain the stream.
File "/usr/local/apps/python2.4/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 273, in pull
try:
File "/home/jmjones/svn/home/pppweb/trunk/pppwebproject/tg/pppweb/pppweb/templates/view_cart.py", line 19, in initialize
rslt = initialize(self)
File "/home/jmjones/svn/home/pppweb/trunk/pppwebproject/tg/pppweb/pppweb/templates/master.py", line 21, in initialize
def initialize(self):
TypeError: 'NoneType' object is not callable
Here is some context around line 21 in my master.py:For what is worth I'm experiencing the same bug with the
DataController, it happens after adding/editing one element, the next
operation gives me the same error (NoneType...).
Ciao
Michele
Jeremy Jones wrote:
>Â Â File "/home/jmjones/svn/home/pppweb/trunk/pppwebproject/tg/pppweb/pppweb/templates/view_cart.py", line 19, in initialize
>Â Â Â Â rslt = initialize(self)
>Â Â File "/home/jmjones/svn/home/pppweb/trunk/pppwebproject/tg/pppweb/pppweb/templates/master.py", line 21, in initialize
>Â Â Â Â def initialize(self):
> TypeError: 'NoneType' object is not callable
>
For what is worth I'm experiencing the same bug with the
DataController, it happens after adding/editing one element, the next
operation gives me the same error (NoneType...).
I think it would be really nice to add an option for this and have it
activated in the default dev.cfg
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
.------------------------------------------------------------------------,
\ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
'--------------------------------------------------------------------'
La máquina de la moneda, mirá como te queda!
-- Sidharta Kiwi
> On 1/2/06, *Jeremy Jones* <zane...@bellsouth.net
> <mailto:zane...@bellsouth.net>> wrote:
>
> David Stanek wrote:
>
>>
>>
>> On 1/2/06, *Jeremy Jones* <zane...@bellsouth.net
I just double checked and I don't find any "initialize" variable
anywhere in this app. Thx,
- jmj
Thanks all,
- jmj
Whereabouts do I need to add 'KID_OUTPUT_PY="true"' to generate the .py
files?
I just svn updated earlier today too.
Cheers,
Tim
Set an environment variable for it. It worked for me.
- jmj
Make sure you don't have any variables with these names:
'content',
'generate',
'initialize',
'pull',
'serialize',
'serializer',
'transform',
'write']
David has some ideas on how to give templates their own namespace but,
for now, these methods defined on BaseTemplate are "using up" those
names.
Kevin
David has some ideas on how to give templates their own namespace but,
for now, these methods defined on BaseTemplate are "using up" those
names.
The only crude way to debug actual Kid errors so far is a trial-and-run
approach with cutting suspicious blocks of code.
I've documented my experience here:
http://max.textdriven.com/blog/entries/69/debugging-kid-templates-and-leaking-abstractions/
Regards,
Max.
- jmj
Kevin
--
Kevin Dangoor
Author of the Zesty News RSS newsreader
email: k...@blazingthings.com
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com
Just to confirm something. I know that initialize was asked about, but
make sure you don't have any of these as variable names:
'content',
'generate',
'initialize',
'pull',
'serialize',
'serializer',
'transform',
'write']
If you have one of these in an if, you might get an error like that
only when the condition is true.
Kevin
jmjones@qiwi 10:29AM pppweb % for phrase in content generate initialize
pull serialize transform write
for> do
for> echo "****************************"
for> echo Checking for $phrase
for> grep $phrase *py
for> echo "****************************"
for> done
****************************
Checking for content
****************************
****************************
Checking for generate
****************************
****************************
Checking for initialize
****************************
****************************
Checking for pull
****************************
****************************
Checking for serialize
tg_store.py: def serialize_details(self):
tg_store.py: element_root = ElementTree.Element("serialized")
tg_store.py: order_item =
model.OrderItem(customer_order=order_id, product=base_id,
quantity=base_quantity, details=cart_item.serialize_details())
****************************
****************************
Checking for transform
****************************
****************************
Checking for write
****************************
The only thing in my controller containing a part of the word is
"serialize", but on anything that should probably cause conflict,
"serialize" is only a piece of some of one of the method names.
Here's checking my templates directory:
jmjones@qiwi 10:31AM templates % for phrase in content generate
initialize pull serialize transform write
do
echo "****************************"
echo Checking for $phrase
grep $phrase *kid
echo "****************************"
done
****************************
Checking for content
do_add_to_cart.kid: <meta content="text/html; charset=UTF-8"
http-equiv="content-type" py:replace="''"/>
form_page.kid: <meta content="text/html; charset=UTF-8"
http-equiv="content-type" py:replace="''"/>
help.kid: <meta content="text/html; charset=UTF-8"
http-equiv="content-type" py:replace="''"/>
master.kid: <meta content="text/html; charset=UTF-8"
http-equiv="content-type" py:replace="''"/>
master.kid: <div id="contents">
master.kid: <div class="flash"
py:content="tg_flash"></div>
master.kid: <!--content-->
master.kid: <td py:content="item[:]" id="main">
master.kid: <!--content-->
registration_successful.kid: <meta content="text/html; charset=UTF-8"
http-equiv="content-type" py:replace="''"/>
****************************
****************************
Checking for generate
****************************
****************************
Checking for initialize
****************************
****************************
Checking for pull
****************************
****************************
Checking for serialize
****************************
****************************
Checking for transform
****************************
****************************
Checking for write
****************************
And I don't see any problems in the "content" stuff above.
- jmj
Also in my quest to eliminate the easy stuff: there *was* a bug in Kid
that prevented comments <!-- --> in the master template. This bug was
fixed (tests written, and all of that), but perhaps you've hit upon an
untested case. I don't think that's the problem though.
The error message that you're reporting doesn't seem right.
def initialize(self):
should not give a "NoneType is not callable" error because nothing is
being called on that line. It's a def statement. The *next* line has a
call:
22 rslt = initialize(self)
but how can initialize be None? (I see why David asked if there was a
variable called initialize specifically).
If possible, you may find it instructive to play with those generated
.py files directly from the Python shell.
Kevin
- jmj
- jmj
David Stanek wrote:
> Too fast an the submit :-(
>
> Actually if you are using the svn version of Kid, do an update and try
> again. I rolled back my py:match changes until I can nail down what
> the semantics should be.
>
> David
>
> On 1/4/06, *David Stanek* <ron...@gmail.com
> <mailto:ron...@gmail.com>> wrote:
>
>
>
> On 1/4/06, *Kevin Dangoor* < dan...@gmail.com
> <mailto:dan...@gmail.com>> wrote:
>
>
> On 1/4/06, Jeremy Jones <zane...@bellsouth.net
> www.roninds.net <http://www.roninds.net>
2006/1/7, Jeremy Jones <zane...@bellsouth.net>:
>
> So, maybe I spoke too soon. I'm getting the error again. And I've
> removed all XML comments from the offending master.kid (as well as the
> template that extends it). I've got the site on Dreamhost now (running
> under fastcgi), but haven't seen the problem there....yet.
I am getting this error too, on the same line (21 of master.py). First
few form submits go without problems, than the error appears and stays
there untill I restart the application :(
--
Ksenia
This is exactly what I'm seeing. It's not on all pages of the
application, although it's not always on the same page. It's just
usually on the same specific page.
- jmj
Same here with the DataController after the first submit (that goes
well).
Ciao
Michele
---
ml
I also have exactly the same problem with the last files from the svn.
>
>
> On 1/8/06, *Minh Luu* <mi...@toll.com.au <mailto:mi...@toll.com.au>>
It's really sporadic with me. I've been running for a couple of hours
now with no problems. Or did you mean that you had made some code
changes that seem to have fixed the problem? If so, I don't mind svn
upping and running it for a while.
- jmj
I'm now running the latest svn and my problem (NoneType with the
DataController) has finally gone away (thanks David).
If you update be sure to reinstall the kid plugin (where David checked
the fix) or you will still get the same error (I've just realized
this).
This means (in turbogears/plugins/kid):
python setup.py install (with sudo if you use it)
or (as I've done):
python setup.py develop
with the last method you don't need to reinstall anymore because the
egg points to your local svn checkout.
Thanks again David.
Ciao
Michele
I just svn upped and looks like the latest Kid is from Wednesday:
jmjones@qiwi 9:08PM trunk % svn info thirdparty/kid
Path: thirdparty/kid
URL: svn://lesscode.org/kid/trunk
Repository UUID: 2e2b2306-ebee-0310-be8d-abc9dabbc1eb
Revision: 246
Node Kind: directory
Schedule: normal
Last Changed Author: dstanek
Last Changed Rev: 246
Last Changed Date: 2006-01-04 12:22:46 -0500 (Wed, 04 Jan 2006)
Properties Last Updated: 2005-12-25 07:01:14 -0500 (Sun, 25 Dec 2005)
Are you going off of a branch, or the trunk? Looks like what I've got
(rev 246) is newer than any of the branches that are in Kid svn.
- jmj
Here are the last lines of the traceback where control is handled to
the kid:
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 136, in render
return t.serialize(encoding=self.defaultencoding, output=format,
fragment=fragment)
File "/home/alberto/turbogears/thirdparty/kid/kid/__init__.py", line
232, in serialize
return serializer.serialize(self, encoding, fragment)
File "/home/alberto/turbogears/thirdparty/kid/kid/serialization.py",
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
File "/home/alberto/turbogears/thirdparty/kid/kid/serialization.py",
line 324, in generate
stream = iter(stream)
File "/home/alberto/turbogears/thirdparty/kid/kid/__init__.py", line
257, in __iter__
return iter(self.transform())
File "/home/alberto/turbogears/thirdparty/kid/kid/__init__.py", line
312, in transform
stream = self.pull()
File "/home/alberto/turbogears/thirdparty/kid/kid/__init__.py", line
271, in pull
self.initialize()
File "/home/alberto/lalala/templates/seccion.py", line 19, in
initialize
import sys
File "/home/alberto/lalala/templates/master.py", line 19, in
initialize
TypeError: 'NoneType' object is not callable
I'm willing to help in what is needed to track down this, unfortunately
I know nothing about kid internals so it can only be in the testing
etc.
Thanks,
Alberto
michele@ionic:~/turbogears/plugins$ svn info kid
Path: kid
URL: http://www.turbogears.org/svn/turbogears/trunk/plugins/kid
Repository UUID: 77541ad4-5f01-0410-9ede-a1b63cd9a898
Revision: 483
Node Kind: directory
Schedule: normal
Last Changed Author: dstanek
Last Changed Rev: 477
Last Changed Date: 2006-01-08 16:22:25 +0100 (Sun, 08 Jan 2006)
I was not refering to the Kid repository but to the Kid template plugin
(TurboKid).
See this message for more info:
http://tinyurl.com/asw49
Ciao
Michele
My problem is fixed now as well with an SVN checkout today. Thanks for
your work on it.
-Mike
I get it only when trying to access my query methods/templates, not on
any of my "static" methods/templates that just serve as html. Once it
breaks, the static methods remain functional, but none of the dynamic
content templates work anymore.
Here's the first error:
Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.1-py2.4.egg/cherrypy/_cphttptools.py",
line 271, in run
main()
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.1-py2.4.egg/cherrypy/_cphttptools.py",
line 502, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 240,
in newfunc
html, fragment, *args, **kw)
File "/home/mikez0r/TG0.9/trunk/turbogears/database.py", line 189, in
run_with_transaction
retval = func(*args, **kw)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 262,
in _execute_func
return _process_output(tg_format, output, html, fragment)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 62,
in _process_output
output = view.render(output, tg_format,
template=template,fragment=fragment)
File "/home/mikez0r/TG0.9/trunk/turbogears/view.py", line 57, in
render
return engine.render(info, format, fragment, template)
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 137, in render
return t.serialize(encoding=self.defaultencoding, output=format,
fragment=fragment)
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 232, in serialize
return serializer.serialize(self, encoding, fragment)
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py",
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py",
line 316, in generate
stream = iter(stream)
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 257, in __iter__
return iter(self.transform())
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 312, in transform
stream = self.pull()
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 271, in pull
self.initialize()
File "/var/www/localhost/htdocs/photogal/photogal/templates/rand.py",
line 19, in initialize
File
"/var/www/localhost/htdocs/photogal/photogal/templates/picmenu.py",
line 20, in initialize
File
"/var/www/localhost/htdocs/photogal/photogal/templates/master.py", line
19, in initialize
TypeError: 'NoneType' object is not callable
If I then refresh the page, I get a second error:
Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.1-py2.4.egg/cherrypy/_cphttptools.py",
line 271, in run
main()
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.1-py2.4.egg/cherrypy/_cphttptools.py",
line 502, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 240,
in newfunc
html, fragment, *args, **kw)
File "/home/mikez0r/TG0.9/trunk/turbogears/database.py", line 189, in
run_with_transaction
retval = func(*args, **kw)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 262,
in _execute_func
return _process_output(tg_format, output, html, fragment)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 62,
in _process_output
output = view.render(output, tg_format,
template=template,fragment=fragment)
File "/home/mikez0r/TG0.9/trunk/turbogears/view.py", line 57, in
render
return engine.render(info, format, fragment, template)
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 123, in render
tclass = self.load_template(template)
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 97, in load_template
mod = _freshen_template(package, basename, tfile, classname)
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 45, in _freshen_template
if _freshen_bases(bases, saved_ctime) or saved_ctime < mtime:
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 23, in _freshen_bases
if _freshen_bases(base.__bases__, saved_ctime):
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 29, in _freshen_bases
mtime = os.stat(sys.modules[modname].__file__).st_mtime
KeyError: 'kid.util.template_0x3E44F9BL'
Tried to fix by getting latest SVN, running python setup.py develop,
and also running python setup.py install in the plugins/kid directory.
Now only my dynamic-data templates will load.
Same error message as the first one above, and refreshing this time
only results in the same error, not a different one.
Eh. Maybe my hack isn't *too* much of a violation of DRY since I am
doing <div py:content="document('header_extracted_from_master.kid)"></div>
and the same with the footer.
- jmj
Make sure you're running the latest rev of Kid, TurboKid and
TurboGears. The recent reports seem to be positive.
Kevin
--
Kevin Dangoor
Author of the Zesty News RSS newsreader
email: k...@blazingthings.com
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com
Kevin
Mine cleared up - can't really explain why. I noticed that after
wiping out all TG-related eggs in site-packages, then re-running python
setup.py develop in trunk, then running python setup.py install in
plugins/kid, it worked for a little while. So whenever it would break,
I'd just go through that process. I keep on expecting it to break
again, but it's been running smoothly for a couple of days now, despite
my best efforts.
Mike
- jmj
py;extends="'master.kid'" functions very differently from
py:extends="sitetemplate" (the single quotes have Kid go hunting
around for the template, whereas the sitetemplate way without the
quotes refers directly to a module available in your template module's
namespace). So, maybe there does remain some issue there.
Kevin
I haven't removed any master extensions. Still no errors today... I'll
certainly post here if I encounter one.
-Mike