Hello all, I am working with newest versions of RF: Python 2.7.3 Jython 2.5.3 RF 2.7.6 I implemented my own Java Library, called DOTTLibrary.jar, extending AnnotationLibrary; I made SwingLibrary available in the Robot lib directory, and my keyword it is callable successfully. I want to create the keyword description as HTML and XML file and called libdoc (as the library is a Java library, I called libdoc via jython, from the directory where the library is located), but libdoc throws an error: C:\Robot\Testautomation\lib>jython -m robot.libdoc -f html DOTTLibrary.jar DOTTL
ibrary.html
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Robot\Jython\Lib\runpy.py", line 85, in run_module
loader = get_loader(mod_name)
File "C:\Robot\Jython\Lib\pkgutil.py", line 464, in get_loader
return find_loader(fullname)
File "C:\Robot\Jython\Lib\pkgutil.py", line 474, in find_loader
for importer in iter_importers(fullname):
File "C:\Robot\Jython\Lib\pkgutil.py", line 425, in iter_importers
__import__(pkg)
ImportError: No module named robot
Tools.jar from Java JDK, and also DOTTLibrary.jar, is available in the CLASSPATH.
So how is the correct call and the correct environment of libdoc.py?
Best regards Gerhard
When you type jython -m robot.libdoc, you are telling Jython to look for the installed module robot, which is installed in Python not Jython (Jython has its own site-packages folder), thus the error.
If you get the standalone robot framework jar on the classpath along with your library, tools.jar, and the standalone JavaLib-Core, you should be able to do this:
java org.robotframework.RobotFramework libdoc <your class name> DOTTLibrary.html
Alternatively you can invoke libdoc similarly to how jybot works (there is no file in the Scripts folder for launching libdoc just run and rebot).
jython <path to Python install>\Lib\site-packages\robot\libdoc.py <your class name> DOTTLibrary.html
Note that you should pass in your class name (the one that extends AnnotationLibrary), not the file name of a .jar or .java file. You want libdoc to load the library as a dynamic api library and get the data from your @RobotKeyword and @ArgumentNames annotations and not the javadoc comments.If you are using Maven I strongly suggest looking at the RF plugin for Maven because it makes this much easier.
Kevin
Hi Kevin,
I installed RF via the Win64 installer; I don´t find any standalone robot framework jar (I assume it would be under <python-install>\Lib\site-packages?
So I tried this (DOTTLibrary is also the name of the main class):
C:\Robot\Testautomation\lib>jython C:\Robot\Python\Lib\site-packages\robot\libdoc.py -f HTML DOTTLibrary DOTTLibrary.html
Calling dynamic method 'getKeywordDocumentation' failed: NullPointerException
Any other idea? I do not use Maven.
Thanks and best regards
Gerhard