RIDE: Pythonpath is not applied when loading libraries

Consider attached small example of a test suite that references a Python Robot library, that in turn references a technical library. All in separate folders from a single root folder called Example.

When I open the test_suite folder in RIDE and try to run it, it fails at first. This is expected, because both the Robot library and the technical library are imported using a path starting in the Example folder: domain_lib.MyRobotLib.py and tech_lib.myTechLib.

[ ERROR ] Error in file 'C:\Users\johan.foederer\sandbox\Example\test_suite\A.robot' on line 2: Library 'domain_lib\MyRobotLib.py' does not exist.

This can be fixed by setting the Pythonpath in RIDE’s settings: image

Setting .. in the Pythonpath suffices to run the test suite successful. Using a relative path is useful because it always works, even when switching between multiple projects that use the same basic structure. Absolute paths also work, though.

The issue is that the Pythonpath is used only for running the test suite, not when loading libraries. This causes the libraries to turn up red and documentation and auto-completion to be unavailable. This is still the case after restarting RIDE. image

A work around is to open a command prompt, create the Pythonpath env variable and then start RIDE from the prompt. This is however not a suitable solution for people that are not accustomed to using command line and are expected to just open the project using the desktop short cut.

Download the example: Example.zip

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I appreciate the effort, so if this is the best, I’ll happily take it.