Bulbuzor
Bulbuzor

Reputation: 39

Module robot.api not found when importing in python code

I have a Python/Selenium project where I need to run code from a different file than the main one with from ABC import XYZ, but in the same driver (without opening a new window). From what I found, it seems that the idea is to make a singleton file, which I've done using the code from their website.

Initially, I've been getting "lib not found", which was fixed with pip install robot, but now I'm running into "No module named 'robot.api'" and I can't seem to find the issue. Tried pip install robotframework-databaselibrary but that wasn't it.

What am I missing here? FYI, my singleton.py is in the same folder as the other two .py files and my first line "from robot.api import logger" is greyed out in PyCharm.

Upvotes: 1

Views: 5679

Answers (1)

Todor Minakov
Todor Minakov

Reputation: 20057

You have installed the wrong package - robot looks like a Django library, while you need robotframework:

pip install robotframework

But before installing the correct one, remove the robot package - you'll have two with the same name, and the "wrong" probably resolves first.

Upvotes: 5

Related Questions