python xmlrpclib “cannot marshal None unless allow_none is enabled”

Just another puzzle before the weekend. After some refactoring and tearing things apart to make them testable (funny enough after a 2 day TDD course) I have stumbled upon the following error (replaced the methods/parameters with stars…):

http://localhost:8051. . :cannot marshal None unless allow_none is enabled">.
File "*****.py", line 242, in run *****(*****)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 1147, in __call__ return self.__send(self.__name, args)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 1437, in __request verbose=self.__verbose
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 1201, in request return self._parse_response(h.getfile(), sock)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 1340, in _parse_response return u.close()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 787, in close raise Fault(**self._stack[0])

Apparently while putting things into separate methods I have omitted return values to be properly returned from the inner to the outer methods, which in Python world means None return value. So the client from an XMLRPC client to the server returned None, which is apparently not handled by the standard XMLRPC protocol (unless some extensions like suggested ‘allow_none’ are used).

So again, if it worked, but then ‘suddenly’ stopped, check if the method called via XMLRPC is properly ending with a return statement which is not evaluating to None.