Unable to import DateTime library in Robot Framework - datetime

I want to use keywords written in DateTime Library
http://robotframework.googlecode.com/hg/doc/libraries/DateTime.html?r=2.8.5
I have robot framework 2.8.6.
Whenever I import this library in my tests in RIDE; it is shown in red (not resolved). Also in documentation I am not able to search the keywords.

Your problem is probably with RIDE and not Robot Framework. RIDE uses its own copy of RF regardless of what you have installed. The included version is out of date. Try copying DateTime.py from Robot Framework installation to the folder in RIDE.
For example, copy C:\apps\Python27\Lib\site-packages\robot\libraries\DateTime.py to
C:\apps\Python27\Lib\site-packages\robotide\lib\robot\libraries
Then restart RIDE.

ombre42 is right, RIDE (my current is 1.3.0) includes an older version of RobotFramework which does not includes DateTime module. You have the RobotFramework 2.8.6 installed, but you doesn't use it when you launch tests using RobotFramework-RIDE.
Two important things:
Copy DateTime.py from your RobotFramework 2.8.6 as ombre42 said, but don't import DateTime using pip: it will work but you'll not get the RobotFramework's one (which is better and documented).
When you run your tests outside of RIDE, in a Jenkins environment for example, you'll probably use the RobotFramework 2.8.6 (or later) and not the same as your RIDE environment.

I'm use RF with Python and by default my IDE sees Python DateTime library.
Use full path:
Library robot.libraries.DateTime

Related

RobotFramework RIDE cannot import library

I have a file right here: Library ../../MyLib/My_Lib.py, and I try to import the python file in RIDE, but RIDE still report "FAIL : No keyword with name '****' found", and this keyword is defined in the My_Lib.py, seems RIDE cannot find the python file.
I using python 2.7.8+Robot Framework 3.1.2+windows server 2012r2. I even selected Library -> Name -> Browse in RIDE, but the error still there and this whole robot test case folder is copied from another server which is working fine
Can anyone suggest what have I missed?
Ah! I have worked this out, if anyone else meets the same issue, you can click Tools->view RIDE Log, to see what's happening there. For my case, it's because I didn't install thrift but the My_Lib.py obviously used thrift module, so the My_Lib.py compile failed with "No module named thrift.Thrift".
Is it possible the Python library was created to work with Python 3.x.x leading it to not work on your Python 2.7.8? See https://wiki.python.org/moin/Python2orPython3
Check what python version is being run on the other server where the test is running fine. You might need to update your local Python version.
Also, you could try running the Robot test outside of RIDE just in case. You may do so by navigating to the test folder where the .robot file resides and running the following command:
robot test_file_name.robot
See if you get the same error that way. Please report back after doing the mentioned checks and we can continue debugging, my reputation doesn't let me comment on your question so I will just update the answer as we go along.

Selenium2Library keywords not recognized in PyCharm

I am new to the RobotFramework and wanted to get a simple example up and running on PyCharm. I am not too clear on what exactly I need to run the Robot Framework so I installed Python 2.7, robotframework, selenium and robotframework-selenium2library. I am not sure if I need to install the webdriver or the googlechrome driver as well.
What am I missing so that I can run this example? I am really clueless.
You have to download the chromedriver.exe and have to keep it in C:\Python27\Scripts folder. It will pick up the exe from there and run your code.
and follow link

How to call python module in Robot framework

I do have the following folder structure for python scripts.
From Python I can run a script in folder Feed2Scripts as follows. Can this be possible in Robot Frame Work through imported libraries? > Note that I have common scripts in ‘GeneralScripts’ used by all other scripts in different folders
../Scripts>python –m Feed2Scripts.Script1 param1
If I just import Feed2Scripts/Script1.py as a library in RF, then It is failing to load libraries defined 'GeneralScripts'
First you set your python path on RIDE's Tools->Preferences->Importing Pythonpath so it does include your library and all its dependencies (imported modules and so on), like this:
(If your library is distributed via PIP, just pip install my_library_package_name instead, on the same environment you are running Robotframework/RIDE)
Then you can add the library to your test suite on the add library dialog you can open by pressing the library button on the Edit tab you can see when you select the suite:
After that, all keywords defined in your library will be available for use in any test of the test suite. You will see a Library import sentence on the Settings section of the header of your suite's code (On your text editor or RIDE's Text Edit tab of the suite:
Sometimes RIDE doesn't recognize the keywords on a recently added or modified library right away. In that case, Save all (CTRL+SHIFT+S) and restart RIDE to fix the issue.
Also, watch out for the library entry showing up in red on the suite import list on RIDE's Edit tab; it means something went wrong when trying to import the library. If you need to know what, you can find the trace on RIDE's Tools->View Ride Log.

Let atom editor recognize external APIs

I'm trying to set up a python like environment with Atom-editor on a Linux machine.
I find the autocomplete-python package that uses jedi.
In the settings of the package I tried to add some python path where the APIs are (/usr/lib/python2.7/dist-packages/) but then the autocompletion doesn't recognize these libraries (for example the PyQt ones)
Am I missing something?
For anybody having the same issue please look here.
Basically everything should work out of the box, but if it does not -- try to configure path to python executable with which you have installed your external module. If it's still fails to complete -- try to configure extra path to python modules. (usually your site-packages directory)

Compiling haskell module Network on win32/cygwin

I am trying to compile Network.HTTP (http://hackage.haskell.org/package/network) on win32/cygwin. However, it does fail with following message:
Setup.hs: Missing dependency on a foreign library:
* Missing (or bad) header file: HsNet.h
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Unfortuntely it does not give more clues. The HsNet.h includes sys/uio.h which, actually should not be included, and should be configurered correctly.
Don't use cygwin, instead follow Johan Tibells way
Installing MSYS
Install the latest Haskell Platform. Use the default settings.
Download version 1.0.11 of MSYS. You'll need the following files:
MSYS-1.0.11.exe
msysDTK-1.0.1.exe
msysCORE-1.0.11-bin.tar.gz
The files are all hosted on haskell.org as they're quite hard to find in the official MinGW/MSYS repo.
Run MSYS-1.0.11.exe followed by msysDTK-1.0.1.exe. The former asks you if you want to run a normalization step. You can skip that.
Unpack msysCORE-1.0.11-bin.tar.gz into C:\msys\1.0. Note that you can't do that using an MSYS shell, because you can't overwrite the files in use, so make a copy of C:\msys\1.0, unpack it there, and then rename the copy back to C:\msys\1.0.
Add C:\Program Files\Haskell Platform\VERSION\mingw\bin to your PATH. This is neccesary if you ever want to build packages that use a configure script, like network, as configure scripts need access to a C compiler.
These steps are what Tibell uses to compile the Network package for win and I have used this myself successfully several times on most of the haskell platform releases.
It is possible to build network on win32/cygwin. And the above steps, though useful (by Jonke) may not be necessary.
While doing the configuration step, specify
runghc Setup.hs configure --configure-option="--build=mingw32"
So that the library is configured for mingw32, else you will get link or "undefined references" if you try to link or use network library.
This combined with #Yogesh Sajanikar's answer made it work for me (on win64/cygwin):
Make sure the gcc on your path is NOT the Mingw/Cygwin one, but the
C:\ghc\ghc-6.12.1\mingw\bin\gcc.exe
(Run
export PATH="/cygdrive/.../ghc-7.8.2/mingw/bin:$PATH"
before running cabal install network in the Cygwin shell)

Resources