robotframework学习2-导入HttpLibrary.HTTP报错

虽然搭建robotframework环境变得超级简单了,但是在导入HttpLibrary.HTTP的时候报错了
报错信息如下所示:

20200724 19:49:21.534 WARN): Importing test library "Httplibrary.HTTP" failed 

Traceback (most recent call last):
Importing test library 'ttpLibrary.HTTP' failed: SyntaxError: invalid syntax(_ init_ _py, line 16)
Traceback (most recent call last);:
File "E:\Program Files (x86)\Python3\lib\site-packages\robotide\lib\robot\utis\importer.py" line 153, in. import
return_ import_ (name, fromlist=fromlist)
PYTHONPATH:
E:\Program Files (x86)\Python3\python37.zip
E:\Program Files (x86)\Python3\DLLs
E:\Program Files (x86)\Python3\lib
E:\Program Files (x86)\Python3
E:\Program Files (x86)\Python3\ib\site-packages
E:\Program Files (x86)\Python3\lib\site-packages\win32
E:\Program Files (x86)\Python3\lib\site-packages\win32\ib
E:\Program Files (x86)\Python3\lib\site-packages\Pythonwin
E:\Program Files (x86)\Python3\lib\site-packages\robotide\spec
E:\Program Files (x86)\Python3\lib\site-packages\robotide\lib
E:\Program Files (x86)\Python3\libsite-packages\robotide\contribtestrnne../lib
E:\Program Files (x86)\Python3\libsite-packages\robotide\contribtestrune./lib
File "E:\Program Files (x86)\Python3\Lib\site-packages\robotide\spec\librarymanager.py", line 87, in fetch keywords
	return get. import result(path, library. args)
File "E:\Program Files (x86)\Python3\Lib\site-packages\robotide\spec\libraryfetcher.py", line 24, in get import result
	lib = robotapi.TestLibrary(path, args)
File "E:\Program Files (x86)\Python3\Lib\site-packages\robotide\lib\robot\running\testlibraries.py". line 50, in TestLibrary
	return source=True)
File "E:\Program Files (x86)\Python3\Lib\site-packages\robot\utils\importer.py". line 72, in import. class _or module
	self. raise import. failed(name, err)
File "E:\Program Files (x86)\Python3\Lib\site-packages\robot\utils\importer.py. line 109, in. raise import failed
	raise DataError('\n' .join(msg))

经过查阅资料发现是版本不兼容导致的。
解决方法:
1.检查livetest,json是否已成功安装(检验方法就是使用import可以导入成功);
在这里插入图片描述
2.修改__init__.py (文件路径:E:\Python37\Lib\site-packages\HttpLibrary)
将from urlparse import urlparse 修改为from urllib.parse import urlparse
将except ValueError, e修改为 except ValueError as e (共两处)
3.重启ride,导入成功(HttpLibrary.HTTP字体显示黑色即代表成功,若是红色代表失败)。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值