[Stackless] [Twisted-web] Stackless and Nevow integration

Simon Pickles sipickles at googlemail.com
Tue May 13 09:34:51 CEST 2008


> On Mon, 12 May 2008 14:07:22 +0100, Simon Pickles <sipickles at 
> googlemail.com 
> <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web>> wrote:
>> /Hi
> />/
> />/has anyone managed to combined Nevow with Stackless Python?
> />/
> />/I have rebuilt stackless after satisfying all the extension libs 
> (to include />/zLib), but now Nevow baulks at the mention of the 
> global 'stackless'
> /
> I don't understand how this could actually be related to Nevow.  Nevow is
> just a Python library.  If you have NameErrors, it's because you wrote 
> some
> code using a name that wasn't defined. :)  Does adding, say, "import 
> stackless"
> to the top of your program fix the problem?  If not, post some code 
> that shows
> how it breaks.
>
> Jean-Paul
>
It looks like a nevow issue in some introspection process used to import 
loaders. Looking at the callstack, its actually a twisted file which throws.

Example:

#=====================
import sys

# link to standard python packages (like twisted and nevow)
sys.path.append("/usr/lib/python2.5/site-packages")

# Has no effect
import stackless

# causes Attribute Error under stackless python, fine in normal python
from nevow import loaders
#=====================

Callstack:

simon at simon-linux:~/Dev/Hub$ spython nevStack.py
Traceback (most recent call last):
  File "nevStack.py", line 11, in <module>
    from nevow import loaders
  File "/usr/lib/python2.5/site-packages/nevow/__init__.py", line 226, 
in <module>
    loadFlatteners(flatteners)
  File "/usr/lib/python2.5/site-packages/nevow/__init__.py", line 39, in 
loadFlatteners
    flat.registerFlattener(f, clean(o))
  File "/usr/lib/python2.5/site-packages/nevow/flat/ten.py", line 36, in 
registerFlattener
    forType = util._namedAnyWithBuiltinTranslation(forType)
  File "/usr/lib/python2.5/site-packages/nevow/util.py", line 183, in 
_namedAnyWithBuiltinTranslation
    return namedAny(name)
  File "/usr/lib/python2.5/site-packages/twisted/python/reflect.py", 
line 432, in namedAny
    obj = getattr(obj, n)
AttributeError: 'slpmodule' object has no attribute 'function'


I thought maybe I needed to build twisted and Nevow with stackless 
python instead so tried that. Twisted works, installing into 
/usr/local/lib but Nevow fails at the same point as above:

simon at simon-linux:~/Source/Nevow$ sudo spython setup.py install
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import setupcommon
  File "/home/simon/Source/Nevow/setupcommon.py", line 2, in <module>
    from nevow import __version__ as version
  File "/home/simon/Source/Nevow/nevow/__init__.py", line 226, in <module>
    loadFlatteners(flatteners)
  File "/home/simon/Source/Nevow/nevow/__init__.py", line 39, in 
loadFlatteners
    flat.registerFlattener(f, clean(o))
  File "/home/simon/Source/Nevow/nevow/flat/ten.py", line 36, in 
registerFlattener
    forType = util._namedAnyWithBuiltinTranslation(forType)
  File "/home/simon/Source/Nevow/nevow/util.py", line 183, in 
_namedAnyWithBuiltinTranslation
    return namedAny(name)
  File 
"/usr/local/lib/python2.5/site-packages/twisted/python/reflect.py", line 
432, in namedAny
    obj = getattr(obj, n)
AttributeError: 'slpmodule' object has no attribute 'function'

I guess I am getting in a muddle ;)

Thanks for any advice and your continued patience!

Si






More information about the Stackless mailing list