Ticket #9919 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

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

Reported by: framay Assigned to: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: olemis 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

Change History

(follow-up: ↓ 2 ) 03/22/12 13:22:00 changed 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

(in reply to: ↑ 1 ; follow-up: ↓ 3 ) 03/22/12 14:24:28 changed by anonymous

  • status changed from new to closed.
  • resolution set to fixed.

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.

(in reply to: ↑ 2 ) 03/22/12 14:37:53 changed by osimons

  • status changed from closed to reopened.
  • resolution deleted.

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...

03/22/12 22:15:26 changed by osimons

  • status changed from reopened to closed.
  • resolution set to fixed.

(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.


Add/Change #9919 (AttributeError: 'NoneType' object has no attribute 'splitlines')




Change Properties
Action