marmojezz
(Jefferson Fernando de Araujo)
28 April 2024 01:33
1
Hello There!
According to the page Project Structure | ROBOT FRAMEWORK ,
Good Practice: Use --pythonpath
command line argument and resources/
subfolder
As you can see in the image below, I did it and the script was properly executed with the commandrobot --pythonpath . .\tests\
.
However, the visual code reports the following errors:
Unresolved resource: resources/common.resourcerobotframework
Unresolved variable import: data/dummy/users.pyrobotframework
As you can also see in the image, I tried to add the following setting but the problem persis.
{
...
"robot.pythonpath": [
"./",
],
...
}
Do you have any idea to solve that visual problem?
Thank you in advance!
Jefferson
Many
(Many Kasiriha)
3 May 2024 04:43
2
Can you open the settings dialog in vs code, search for pythonpath and check the robotcode setting for pythonpath in that dialog?
Just want to be sure that your ./ is really entered there.
You could also try adding . instead of ./
1 Like
daniel
(Daniel Biehl)
3 May 2024 13:49
3
With Robot Framework Language Server
you need to add absolut paths (means full paths) to the robot.pythonpath
setting. The ‘.’ is not enough. This is a bit weird because for calling robot on the command line you don’t need this.
And by the way: the robotframework language server
extension is currently no longer being actively developed.
2 Likes
Many
(Many Kasiriha)
3 May 2024 15:04
4
Oh, I overlooked that it is about LSP (and not Robot Code).
With LSP you can avoid typing the full path by using some variables.
So you can add the Pythonpath like that to the settings:
"robot.pythonpath": [
"${workspaceFolder}", "${workspaceFolder}/lib", "${workspaceFolder}/resources", "${workspaceFolder}/keywords"
]
${workspaceFolder} means here your project root folder.
It will be resolved to the absolute path
2 Likes
marmojezz
(Jefferson Fernando de Araujo)
4 May 2024 00:30
5
Many:
"robot.pythonpath": [
"${workspaceFolder}", "${workspaceFolder}/lib", "${workspaceFolder}/resources", "${workspaceFolder}/keywords"
]
This message gives me all we need. Thank you!
Just a final comment. I verified that the problem was solved adding only the workspace folder as showed below
{
...
"robot.pythonpath": [
"${workspaceFolder}"
]
}
1 Like