RED
RED copied to clipboard
While importing python library can we avoid to specify argument values
I am able to use the python library keyword if I specify the argument value in red.xml.
But I have so many python libraries in the existing project and wanted to import all python files as a library. while importing it is giving error for the expected arguments.
I don't want to give argument values there. Because development is in progress and every day so many changes are coming in for the library. So, want to avoid every time to update and add an argument part
Please find below the error sample screenshot.
Also, suggest if there is any other way or workaround.
Is there a way to import python library without specifying a value for the argument.
Hmn, I'm no expert here but seems to me that the way you are declaring your custom library's constructor means you need 2 arguments, a host parameter and a port parameter. So maybe changing your constructor and declaring a default host argument will help get you where you want to go. If I am understanding your problem correctly.
@humbienri ,
You are right. If I change constructor it will solve my problem. But the issue is I have so many library files and if I change the constructor in some file need to handle for default arg case check also. So, here, do not want to change existing code which is running fine. Also, if I change, it will affect multiple people also and frankly telling don't want to convince all people to prepare library with construction to have a default value in args.
Hi,
yes, if your library constructor has arguments and you want RED to recognize this library and provide all the features then you either need to:
- modify the constructor to be able to instantiate library via 0-arg call
- provide all the required arguments by setting them in
red.xmlfile
This is actually not something that RED itself requires, but this is inherited from Robot libdoc tool (https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#library-documentation-tool-libdoc) which is used by RED to generate list of keywords with their signatures and documentations. When generating those files libdoc creates an instance of a library so the arguments has to be provided once they are required.