Robot Code reports error that should be reported during runtime

Hello everybody,

— The situation —
For an UI automation/RPA project, I’m using the python library called ‘lackey’. This works similarly as the sikulyLibrary: try to find a pattern on the UI, using a png-file which is stored on disk. This works fine.

When the png-file during runtime is not located on disk, he can’t find it and reports an exception: ‘ImageMissing’. …as expected…o far so good

---- The problem ----

yesterday I installed the Robot Code extension (by @daniel ) for VS Code, replacing the deprecated extension ‘Robot Framework Intellisense’

The problem:
Robot Code is complaining that images are missing. See attached screenshot.
During runtime this is NOT an issue,…because the location where to look for the png’s is provided during runtime.
(note: I can’t use the Robot Code extension to run the script :frowning: , but just using the command line to run the script, it works fine. So there’s no problem(!) with the testcase itself)

my question is
How to get rid of the reported error by Robot Code?
It seems like this error shouldn’t be shown

other question:

  • I guess this error prevents Robot Code to detect the python functions as Keywords?
    With ‘Robot Framework Intellisense’ this worked fine.

I hope the problems is clear and someone can help me to resolve it.

Kind regards,
Daniel

Hi,

The old plugin did not really load the libraries to get the completion. It was just statically taking functions.

I would say, that the library you are using is not implemented correctly.

Robot Code uses Robot Frameworks tool libdoc to detect the keywords.
As your library can not be loaded by libdoc without that argument, this is an issue.

I would recommend to refactor your Library so that you do not need these arguments/images during library init. Only when a keyword is called.
Libdoc, and therefore also Robot Code, does not call keywords, but executes the init(self) function.

For this kind of “lazy” init, you can use @properties in python.

Cheers René

Alternatively, generate a .libspec for the library. I do that for all libraries that must take init arguments and I put the .libspec next to the .py libraries that they belong to (same file name, different extension). That should also fix the issue.