Fehler beim Generieren von libspec: Beim Versuch, Python-Bibliotheken mithilfe der Datei „libraries.resouce“ in das RoboPython

Python-Programme
Guest
 Fehler beim Generieren von libspec: Beim Versuch, Python-Bibliotheken mithilfe der Datei „libraries.resouce“ in das Robo

Post by Guest »

Code: Select all

IDE: VSCode
Python 3.10 + RobotFramework 5.0.1
vscode extension: Robot Framework Language server 0.47.2
Ordnerstruktur:
Image

In der Datei „libraries.resource“ rufe ich die dbutils-Bibliothek auf als:

Code: Select all

Libraries     ./libraries/Utilities/utils.py
In meine utils.py-Datei importiere ich die Datei dbutils.py als:

Code: Select all

from libraries.DBUtilities.dbutils import dbutils

class utils():
def __init__(self):
self.ut = dbutils()
Bei diesem Setup gibt der Robotframework-Sprachserver den folgenden Fehler aus:

Code: Select all

Unresolved library: ../libraries/Utilities/utils.py
Error generating libspec:
Importing library 'utils' failed: ModuleNotFoundError: No module named 'utils'
Consider adding the needed paths to the "robot.pythonpath" setting
and calling the "Robot Framework: Clear caches and restart" action.robotframework
Ich habe versucht,
  • Import statt von
    < zu verwenden /li>
    verwenden Sie try: und außer:
  • fügen Sie die Bibliotheken zur vscode-Arbeitsbereichsdatei unten hinzu Abschnitt „robot.pythonpath“
  • angewendet „Robot Framework: Clear Caches und Neustart“ aus der vscode-Befehlspalette
Bearbeiten 1:

Code: Select all

project workspace file has the following settings:

"robot.pythonpath": ["${workspaceFolder}/.venv/Scripts/python.exe", "${workspaceFolder}/libraries"],
"robot.language-server.python": "${workspaceFolder}/.venv/Scripts/python.exe",
"robot.python.executable": "${workspaceFolder}/.venv/Scripts/python.exe",

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post