Re: [Twisted-web] Stackless and Nevow integration
/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
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: 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@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@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
On Tue, 13 May 2008 08:34:51 +0100, Simon Pickles <sipickles@googlemail.com> wrote:
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.
Ah. I'd completely forgotten about that code. I suspect it should just be deleted. Can you file a ticket for this and attach the traceback? Jean-Paul
Jean-Paul Calderone wrote:
On Tue, 13 May 2008 08:34:51 +0100, Simon Pickles <sipickles@googlemail.com> 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
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: 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.
Ah. I'd completely forgotten about that code. I suspect it should just be deleted. Can you file a ticket for this and attach the traceback?
Will do. Can you suggest a quick mod I can make (which lines to delete) so I can progress? Thanks Jean Regards Simon
On Tue, 13 May 2008 17:04:58 +0100, Simon Pickles <sipickles@googlemail.com> wrote:
Jean-Paul Calderone wrote:
On Tue, 13 May 2008 08:34:51 +0100, Simon Pickles <sipickles@googlemail.com> wrote:
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.
Ah. I'd completely forgotten about that code. I suspect it should just be deleted. Can you file a ticket for this and attach the traceback? Will do. Can you suggest a quick mod I can make (which lines to delete) so I can progress? Thanks Jean
I think something like this should help: Index: Nevow/nevow/__init__.py =================================================================== --- Nevow/nevow/__init__.py (revision 15766) +++ Nevow/nevow/__init__.py (working copy) @@ -207,16 +207,6 @@ nevow.i18n.flattenL10n nevow.i18n.PlaceHolder """ -flatteners_stackless = """ -nevow.flat.flatstan.FunctionSerializer stackless.function -nevow.flat.flatstan.MethodSerializer stackless.instancemethod -""" -try: - import stackless - flatteners += flatteners_stackless -except ImportError: - pass - flatteners_2_4 = """ nevow.flat.flatstan.StringCastSerializer decimal.Decimal """
participants (2)
-
Jean-Paul Calderone
-
Simon Pickles