簡體   English   中英

在 Robotframework 中導入“asammdf”時出錯

[英]Error in importing “asammdf” in Robotframework

我在 python 中編寫了一個自定義庫,它導入了一個名為“asammdf”的 package。 但是,當我在機器人代碼中導入自定義庫時,在 python 中導入“asammdf”時顯示錯誤。 它說:“文件 *.robot 中的錯誤。導入測試庫 *.py 失敗。導入錯誤:DLL 加載失敗:找不到指定的模塊。”

“asammdf” package 在它在執行期間提到的 PYTHONPATH 之一中可用。

有人可以幫我做這件事並讓我知道,我做錯了什么嗎? 我的 python 文件(trialRobot.py):

import asammdf
...
...
...

我的機器人文件(TC1.robot):

*** Settings ***
Library trialRobot.py

*** Test Cases ***
TC1
   DO THIS
   DO THAT

它顯示的錯誤是:

[ ERROR ] Error in file 'G:\AutomationRobotFramework\RobotAutomationFramework\TC1.robot': Im
porting test library 'G:\AutomationRobotFramework\RobotAutomationFramework\trialRobot.py' fa
iled: ImportError: DLL load failed: The specified module could not be found.
Traceback (most recent call last):
  File "G:\AutomationRobotFramework\RobotAutomationFramework\trialRobot.py", line 1, in <mod
ule>
    import asammdf
  File "g:\automationrobotframework\venv\lib\site-packages\asammdf\__init__.py", line 15, in
 <module>
    from .blocks.mdf_v2 import MDF2
  File "g:\automationrobotframework\venv\lib\site-packages\asammdf\blocks\mdf_v2.py", line 4
, in <module>
    from .mdf_v3 import MDF3
  File "g:\automationrobotframework\venv\lib\site-packages\asammdf\blocks\mdf_v3.py", line 4
4, in <module>
    from ..signal import Signal
  File "g:\automationrobotframework\venv\lib\site-packages\asammdf\signal.py", line 9, in <m
odule>
    from .blocks.utils import MdfException, extract_cncomment_xml, SignalSource
  File "g:\automationrobotframework\venv\lib\site-packages\asammdf\blocks\utils.py", line 27
, in <module>
    from cchardet import detect
  File "g:\automationrobotframework\venv\lib\site-packages\cchardet\__init__.py", line 1, in
 <module>
    from cchardet import _cchardet

PYTHONPATH:
  G:\AutomationRobotFramework\venv\Scripts\robot.exe
  C:\Program Files\Python37\python37.zip
  C:\Program Files\Python37\DLLs
  C:\Program Files\Python37\lib
  C:\Program Files\Python37
  g:\automationrobotframework\venv
  g:\automationrobotframework\venv\lib\site-packages
  g:\automationrobotframework\venv\lib\site-packages\pip-19.0.3-py3.7.egg

但是,asammdf package 使用 pip 安裝在 python 中,沒有任何名稱或位置沖突。 它只安裝一次,安裝在 pip 默認安裝的文件夾中。 提前致謝。

您需要提供 example.py 文件的絕對路徑或相對路徑。

很喜歡,

*** Settings ***
Library C:/SomeFolder/example.py

或者

*** Settings ***
Library ../folder/example.py

您需要安裝 cchardet 2.1.5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM