These days to study under the Robotframework+http Library (requests) to do interface testing (HTTP protocol), after the installation of the requests library, in the ride import the library when the display is red, that is, import failure (normal import should appear as black), Online also did not search for useful information, so these days are constantly in the company's computer and home computer repeatedly toss. Today at home to rest, continue to toss, Kung fu is not a conscientious, finally settled, in this record.
I. Description of the phenomenon:
My computer was originally installed Robotframework+selenium2library environment (robot Framework Environment Building), so I run directly on the command line: Pip install- u robotframework -requests to install Requestslibrary, and then use ride import, such as selenium2library he databaselibrary are normal, but requestslibrary is red.
Second, the problem-solving process:
first of all , I suspect that there is a problem with the installation, so go to the installation directory (my: C:\Python27\Lib\site-packages) to see if there is a requestslibrary library, and found that the following two installation folders exist in this directory:
- Requestslibrary
- Robotframework_requests-0.3.8-py2.7.egg-info
Installation should be no problem, install no problem what's wrong with that? I suspect it is related to the installation of the environment.
so , to rule out all possible x-factors, I uninstalled all of the previously installed environments on my computer and reinstalled them all. Unfortunately, after this installation is complete, the problem remains unresolved. However, although the problem is not resolved, it is not possible to exclude the installation package from the environment. By this time I began to suspect that a dependency package was missing. (This is the case with open source, which depends on many other packages when installed)
finally , Ride has an import Failed help function (in the Red Box section), click on this button, pop up as a hint, said or quite detailed:
1, import failure display red
2. You can view the detailed failure log under Tools/view RIDE log.
3 、。。。
According to the error log found in the 2nd above:
20150503 08:38:55.590 [INFO]: Started RIDE 1.3 using python version 2.7.8 with wx version 2.8.12.1 in win32.
20150503 08:38:59.105 [WARN]: Importing test library "RequestsLibrary" failed
Traceback (most recent call last):
Importing test library ‘RequestsLibrary‘ failed: ImportError: No module named requests
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\RequestsLibrary\__init__.py", line 1, in <module>
from RequestsKeywords import RequestsKeywords
File "C:\Python27\lib\site-packages\RequestsLibrary\RequestsKeywords.py", line 1, in <module>
import requests
PYTHONPATH:
C:\Python27\lib\site-packages\robotide\lib\robot\libraries
C:\Python27\lib\site-packages\robotide\lib
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\Python27\lib\site-packages\setuptools-5.4.1-py2.7.egg
C:\Python27\lib\site-packages\pip-6.1.1-py2.7.egg
C:\Windows\system32\python27.zip
D:\Program Files\VisualSVN Server\bin
D:\Program Files\VisualSVN Server\PythonPackages
C:\Python27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
.
C:\Users\Administrator\Desktop
C:\Python27\lib\site-packages\robotide\spec
File "C:\Python27\lib\site-packages\robotide\spec\librarymanager.py", line 76, in _fetch_keywords
return get_import_result(path, library_args)
File "C:\Python27\lib\site-packages\robotide\spec\libraryfetcher.py", line 20, in get_import_result
lib = TestLibrary(path, args)
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 37, in TestLibrary
libcode = importer.import_class_or_module(name)
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 64, in import_class_or_module
self._raise_import_failed(name, err)
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 102, in _raise_import_failed
raise DataError(‘\n‘.join(msg))
The problem finally found, the original is less requests, installation address :https://pypi.python.org/pypi/requests
Command Line window run:pip install requests
Import Requestslibrary again with ride, success:
Open a happy research trip ...
Robot framework-requests Library installation process problem solving