Setup: VSCode .devcontainer running a robot tests.
What happens: when running without attachpython, we can set breakpoints inside robot/resource files. However when we enable attachPython we get module not found for all our own helper python files we use.
We noticed that the python path used when running in debug doesn’t contain the lib paths.
our .devcontainer files contains the robot.pythonpat, but once started for debugging these are not in the pythonpath output by the debug console. How to add these in the below generated command?
Robotcode did not use a robot.pythonpath this is from the old rflsp. You should use the robot.toml file or (I am on mobile, did not know the exact setting) in Vscode settings und RobotCode/Run the is a PythonPath setting.
Inside our resource files we reference a *.py library, which contains helper functions.
F.I
Library SdkLibrary
When the attachpython is enabled, this library is no longer found. We get module not found.
In case we reference it using the absolute path it is found.
F.I
Library /workspace/lib/helpers/SdkLibrary.py
We suspect this comes from the fact that the Robotcode with the flag attachPython enabled replaces PYTHONPATH. This doesn’t seem to happen with that flag set to False.
So Instead of:
PYTHONPATH = (our app paths) + (debugpy libs)
As soon as we removed the old robot.pythonpath and used the proper robotcode pythonpath, the debugger got the correct pythonpath and we were able to debug inside our python lib.