Making a portable version of Robotframework and RIDE, how to make it clean?

305 Views Asked by At

I want to adapt Robotframework and RIDE to be able to use them on a USB key. In order to achieve this, I planned to use a Portable Version of Python on which I would install all necessary modules using pip.

The main advantage of Portable Python is that it doesn't required any installation on the user's computer, they just have to use the Console executable provided by Portable Python to access Python and its modules. A simple insertion of the USB key, and the user would have access to the modules.

Let's say I install Portable Python on a USB key, located on E:\. Using E:\PortablePython\Console-Launcher.exe which uses command-lines code with all Python related files in the PATH, I manage to install all necessary packages for RobotFramework and RIDE with pip. For example, we can find the robot.exe in E:\PortablePython\App\Python\Scripts and the python exe is in E:\PortablePython\App\Python\python.exe like a usual installation of Python.

Everything works like a charm here, I can run my tests without any issue. The problems come when the key is moved. If I try to run ride on D:\:

D:\PortablePython>ride.py
Unable to create process using 'E:\PortablePython\App\Python\python.exe "D:\App\Python\Scripts\ride.py" '

It actually works if I write :

D:\PortablePython>D:\App\Python\python.exe D:\PortablePython\App\Python\Scripts\ride.py

But when I try to run tests within RIDE with the robot execution profile, a similar error appears in the console :

Fatal error in launcher: Unable to create process using '"E:\PortablePython\App\Python\python.exe"  "D:\App\Python\Scripts\robot.exe" --version': Le fichier spÚcifiÚ est introuvable.

A workaround is to force the reinstallation of RobotFramework on the USB key to have it use D:\PortablePython\App\Python\python.exe instead of E:\PortablePython\App\Python\python.exe.

So here are my questions:

  • Is there any tweaks available on pip to have packages moveable in a way ? Using relatives paths instead of absolute paths maybe ?
  • Is it possible to have execution profiles in RIDE use the python exe on D:\ instead of the non-existing one on E:\ ?
  • Can virtual environments play a role in this case ?
2

There are 2 best solutions below

0
Pyjaman On BEST ANSWER

It seems I've been using an incomplete version of a Portable Python. I tried to use WinPython instead, which has a script making the installation moveable, and it solved all the issues I mentionned.

First I downloaded all the packages and libraries needed to do my tests, then I applied the make_winpython_movable.bat provided by WinPython. Everything works now when I move the files or the key.

2
Helio On

RIDE uses the $HOME/.robotframework/ride or %APPDATA%\Robotframework\ride directories to create a database of keywords documentation (Help), and the settings.cfg. If you want to preserve this information, you should have a copy in the removable memory, and have some script to create a link to it.

This script may be a better solution to setup RIDE before it is launched. That way you can setup all the needed paths or environment variables, like, for example, PATH, PYTHONPATH.

If your code is Open Source, you can propose improvements to RIDE's portability, at https://github.com/HelioGuilherme66/RIDE