Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While importing python library can we avoid to specify argument values #384

Open
ilesh32 opened this issue Aug 21, 2020 · 3 comments
Open

While importing python library can we avoid to specify argument values #384

ilesh32 opened this issue Aug 21, 2020 · 3 comments
Labels

Comments

@ilesh32
Copy link

@ilesh32 ilesh32 commented Aug 21, 2020

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.
Screenshot 2020-08-21 at 4 24 34 PM
Is there a way to import python library without specifying a value for the argument.

@humbienri
Copy link

@humbienri humbienri commented Aug 21, 2020

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.

@ilesh32
Copy link
Author

@ilesh32 ilesh32 commented Aug 22, 2020

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

@michalanglart
Copy link
Contributor

@michalanglart michalanglart commented Aug 31, 2020

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:

  1. modify the constructor to be able to instantiate library via 0-arg call
  2. provide all the required arguments by setting them in red.xml file

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.