0
votes

I decided to copy exactly the tutorial found here but somehow when i run it i keep getting the error

"[ ERROR ] Error in file 'C:\Users\path\to\tests': Importing test library 'ExampleLibrary' failed: ModuleNotFoundError: No module named 'ExampleLibrary' "

Now i tried both with the .py extension and without, just in case, but for some reason it doesn't work. Both files are in the same folder.

I have python 3 installed. I only copied the .tsv (renamed to a .robot) and .py files.

I don't understand why it doesn't work. If i work with only .robot files everything is fine.

1
You should describe exactly what you're doing in your question, including all the involved source code...not make readers try to construct what you're doing from an external link. - CryptoFool
Can you show what's you do in detail more than this ? - Sidara KEO
Please provide a minimal reproducible example. We can't fix problems in your code without seeing your code. - Bryan Oakley
The link in the first line of the comment describes exactly what I am doing :) - Pain
Note that in case your Python file contains a class which contains a function that you wish to use as a keyword, then the name of the class MUST be the same as the name of the Python file you import as a library, i.e. -Library MyLibrary.py within the *** Settings *** section of the .robot file while the name of the class within the is ALSO exactly MyLibrary, i.e. - within the MyLibrary.py file: class MyLibrary:.... - Guy Avraham

1 Answers

0
votes

You have to specify the relative path from the file .robot to the .py file:

Library ./ExampleLibrary.py

or the absolute. Or put the folder inside the PYTHONPATH env. variable and add the .py extension to the ExampleLibrary, because it is only a file and not a proper library (inside a folder).

Side note, the Python library file is incompatible with Python3 as it is now, and you have to make some minor corrections.