PyCharm/robotframework-lsp running system interpreter instead of venv

Viewed 335

I have a problem running my code under PyCharm. I have selected my venv as the interpreter but when I run os.system(command), PyCharm uses the python installation path instead of the venv path. The code is a Robot Framework library.

import os, platform
from robot.api.deco import keyword


@keyword
def download_driver(browser="chrome"):
    browser = browser.lower()
    if browser == "gc":
        browser = "chrome"
    elif browser == "ff":
        browser = "firefox"

    command = f"webdrivermanager {browser}"
    if platform.system() == "Linux":
        link_path = "$HOME/.local/bin"
        command = f"{command} --linkpath {link_path}"
    os.system(command)

When I run it using terminal (with activated venv) then everything runs fine, but when I run it from PyCharm I get the message below:

'webdrivermanager' is not recognized as an internal or external command,
operable program or batch file.

The library is in the path:

Python interpreter

1 Answers

Ok, I found what is causing the problem and a workaround:

Python template: enter image description here

Robot Framework template and plugin settings look fine, so I assume it's a bug: enter image description here

enter image description here

Related