Hi,
we generate Robot Documentation (html, xml) for our own library using the api. It used to work, but with the change to 3.2.1 we get an issue.
We are still on Python 2.7 (I know… but we have customers still there)
When we try to generate the docs we get this error (with a traceback I added temporary to the logs)
15:35:28,929 INFO - Try --help for usage information.
15:35:28,929 INFO - Building library 'Mock.py' failed: **AttributeError: 'NoneType' object has no attribute 'decode'**
15:35:28,929 INFO - Traceback (most recent call last):
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\libdocpkg\builder.py", line 43, in LibraryDocumentation
15:35:28,929 INFO - libdoc = builder.build(library_or_resource)
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\libdocpkg\robotbuilder.py", line 41, in build
15:35:28,929 INFO - libdoc.keywords = KeywordDocBuilder().build_keywords(lib)
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\libdocpkg\robotbuilder.py", line 103, in build_keywords
15:35:28,929 INFO - return [self.build_keyword(kw) for kw in lib.handlers]
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\libdocpkg\robotbuilder.py", line 111, in build_keyword
15:35:28,929 INFO - source=kw.source,
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\running\handlers.py", line 153, in source
15:35:28,929 INFO - return normpath(inspect.getsourcefile(unwrap(handler)))
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\utils\robotpath.py", line 75, in normpath
15:35:28,929 INFO - path = system_decode(path)
15:35:28,929 INFO - File "C:\Python27\Lib\site-packages\robot\utils\encoding.py", line 104, in system_decode
15:35:28,929 INFO - return string.decode(_SYSTEM_ENCODING)
15:35:28,929 INFO - AttributeError: 'NoneType' object has no attribute 'decode'
Going through the robot code, I found the place where it gets into problem: (robot.running.handlers.py)
class _PythonHandler(_RunnableHandler):
def __init__(self, library, handler_name, handler_method):
_RunnableHandler.__init__(self, library, handler_name, handler_method,
getdoc(handler_method))
def _parse_arguments(self, handler_method):
return PythonArgumentParser().parse(handler_method, self.longname)
@property
def source(self):
handler = self.current_handler()
try:
return normpath(inspect.getsourcefile(unwrap(handler)))
except TypeError: # **changing this to Exception: "solves" our problem**
return self.library.source
This is sort of, the behavior as it used to be in 3.1.2. Any tips how to handle this the best? Shall I report a bug?
/Richard