简体   繁体   English

在 Robotframework 中导入“asammdf”时出错

[英]Error in importing “asammdf” in Robotframework

i have written a custom Library in python, which imports a package named "asammdf".我在 python 中编写了一个自定义库,它导入了一个名为“asammdf”的 package。 But, when i import my custom Library in Robot code, it shows error in importing "asammdf" in python.但是,当我在机器人代码中导入自定义库时,在 python 中导入“asammdf”时显示错误。 It says: "Error in File *.robot. Importing test Library *.py failed. Import Error: DLL load failed: the specified module could not be found."它说:“文件 *.robot 中的错误。导入测试库 *.py 失败。导入错误:DLL 加载失败:找不到指定的模块。”

"asammdf" package is available in one of the PYTHONPATH it mentions during executions. “asammdf” package 在它在执行期间提到的 PYTHONPATH 之一中可用。

Can someone please help me doing this and let me know, what have i done wrong?有人可以帮我做这件事并让我知道,我做错了什么吗? My python File (trialRobot.py):我的 python 文件(trialRobot.py):

import asammdf
...
...
...

My robot file (TC1.robot):我的机器人文件(TC1.robot):

*** Settings ***
Library trialRobot.py

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

The error it shows is:它显示的错误是:

[ 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

But, the asammdf package is installed in python using pip without any name or location conflict.但是,asammdf package 使用 pip 安装在 python 中,没有任何名称或位置冲突。 It is installed only once and in the folder, where pip installs by default.它只安装一次,安装在 pip 默认安装的文件夹中。 Thanks in advance.提前致谢。

You need to provide the absolute path or relative path to the example.py file.您需要提供 example.py 文件的绝对路径或相对路径。

so like,很喜欢,

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

or或者

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

You need to install cchardet 2.1.5您需要安装 cchardet 2.1.5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM