Modify

Opened 13 years ago

Closed 13 years ago

#9919 closed defect (fixed)

AttributeError: 'NoneType' object has no attribute 'splitlines'

Reported by: Franz Owned by: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Olemis Lang Trac Release: 0.12

Description

I am getting the following error with Trac 0.13dev-r10991 running on apache httpd (2.8 (WSGIProcessGroup /trac/trac1 WSGIApplicationGroup %{GLOBAL})) and newest XmlRpcPlugin:

2012-03-22 12:56:47,923 Trac[web_ui] DEBUG: RPC incoming request of content type 'text/xml' dispatched to <tracrpc.xml_rpc.XmlRpcProtocol object at 0x7f719e8ffcd0>
2012-03-22 12:56:47,924 Trac[build\bdist.win32\egg\trac\web\main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\web\main.py", line 478, in _dispatch_request
    dispatcher.dispatch(req)
  File "build\bdist.win32\egg\trac\web\main.py", line 198, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.6/dist-packages/TracXMLRPC-1.1.2_r11306-py2.6.egg/tracrpc/web_ui.py", line 69, in process_request
    self._rpc_process(req, protocol, content_type)
  File "/usr/local/lib/python2.6/dist-packages/TracXMLRPC-1.1.2_r11306-py2.6.egg/tracrpc/web_ui.py", line 139, in _rpc_process
    proto_id = protocol.rpc_info()[0]
  File "/usr/local/lib/python2.6/dist-packages/TracXMLRPC-1.1.2_r11306-py2.6.egg/tracrpc/xml_rpc.py", line 76, in rpc_info
    return ('XML-RPC', prepare_docs(self.__doc__))
  File "/usr/local/lib/python2.6/dist-packages/TracXMLRPC-1.1.2_r11306-py2.6.egg/tracrpc/util.py", line 49, in prepare_docs
    return ''.join(l[indent:] for l in text.splitlines(True))
AttributeError: 'NoneType' object has no attribute 'splitlines'

I tried connecting with eclipse mylyn (newest update). User anonymous has permission XML_RPC.

Attachments (0)

Change History (4)

comment:1 Changed 13 years ago by osimons

Looks like it hasn't got anything to do with Trac or the Trac version, and the code in the plugin is verified and correct.

I suspect you are running Python with 'optimize' settings on. Among other things this strips away docstrings that the plugin uses, and no doubt lots of other parts of Trac and plugins rely on. Trac++ relies on runtime introspection to such a large extent that running Python with optimization switches is generally discouraged (and unsupported).

Could you check optimization options for your config? Likely WSGIPythonOptimize setting for mod_wsgi. Check docs:

http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonOptimize

comment:2 in reply to:  1 ; Changed 13 years ago by anonymous

Resolution: fixed
Status: newclosed

Replying to osimons:

I suspect you are running Python with 'optimize' settings on.

Good guess! That was the problem. I had set WSGIPythonOptimize 2 in my wsgi.conf. Thank you for your immediate and informative answer !!

Among other things this strips away docstrings that the plugin uses, and no doubt lots of other parts of Trac and plugins rely on.

Well, we are running Trac now for almost a year in production mode and hadn't any problems until now. We're using AccountManagerPlugin and some self-made plugins (see list). Is Trac really using the named features (docstrings, etc.) that extensive?!

Trac++ relies on runtime introspection to such a large extent that running Python with optimization switches is generally discouraged (and unsupported).

What's Trac++? Haven't heard of that.

comment:3 in reply to:  2 Changed 13 years ago by osimons

Resolution: fixed
Status: closedreopened

Replying to anonymous:

Is Trac really using the named features (docstrings, etc.) that extensive?!

For much of documentation needs, yes. Most documentation (like help for wiki macros). And for RPC the API docs will not be very useful without it.

However, perhaps the plugin function should at least be made not to fail. Like just returning an empty string if there is no text. Reopening ticket to remember to get that done.

What's Trac++? Haven't heard of that.

Heh. Trac and all related dependencies, plugins and various enhancements = "and more". I didn't feel like listing them all...

comment:4 Changed 13 years ago by osimons

Resolution: fixed
Status: reopenedclosed

(In [11410]) XmlRpcPlugin: Small fix + test to gracefully handle running Python optimized (-OO) that may in fact strip all docstrings (leaving them as None). Fixes #9919.

Running python -OO setup.py test will now at least fail this new test that depends on ability to introspect docstrings.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.