Changing the Python installation used by Squish binary packages

Skip to end of metadata
Go to start of metadata

Table of Contents

Introduction

The Python configuration in the Squish IDE at Edit > Preferences > PyDev is not being used for executing Squish test scripts.

Please do not make any changes at Edit > Preferences > PyDev, unless our technical supports asks you to.

The following instructions change the Python installation used by the Squish package when executing test scripts.

The following instructions change the Python installation used by the Squish IDE 6.2 (or earlier) for editing test scripts. (This does not apply to Squish 6.3 or higher.)

Depending on the operating system, froglogic's Squish binary packages either bundle a Python interpreter or use a Python interpreter provided by the operating system.

Python versions used by Squish binary packages:

Operating System Python version
Linux Python 2.7.x (bundled, SQUISHDIR/python)
Mac OS X Mac OS X's default Python 2.7.x installation (depending on Squish binary package configuration)
Windows Python 2.7.x (bundled, SQUISHDIR\python)

Changing the Python version used by Squish binary packages

If you want to use a more recent version of Python than the one bundled with Squish, and are using Linux or Windows, please contact Squish support since we may be able to provide a Squish binary package with the version of Python you want.

FOR LINUX AND WINDOWS PLEASE NOTE!

The Squish binary package that you use MUST BE BUILT WITH THE PYTHON VERSION THAT YOU WANT TO USE! (The default is Python 2.7.x since Squish 6.0, and 2.4.x in earlier versions.)

You CANNOT use Python 2.6, 3.5, 3.6, etc. with a Squish binary package WHICH HAS NOT BEEN BUILT WITH THAT SPECIFIC PYTHON VERSION!

To obtain a Squish binary package with the desired Python version please contact our support and provide the buildinfo.txt file from the Squish package that you would like to have with a different Python version as well as the desired Python version.

Requirements

  • The Python versions of your Squish binary package and the desired Python installation must be the same .
  • The Python of your Squish binary package and the desired Python installation must both be configured for UCS-2 or UCS-4 . Using Python configured for UCS-4 with a Squish package with Python configured for UCS-2 will result in the following error:

R: /home/myuser/squish-.../lib/_squishrunner: symbol lookup error: /home/myuser/squish-.../lib/libsquishinterpreter.so: undefined symbol: PyUnicodeUCS2_GetDefaultEncoding

R: /home/myuser/squish-.../lib/_squishrunner: symbol lookup error: /home/myuser/squish-.../lib/libsquishinterpreter.so: undefined symbol: PyUnicodeUCS2_FromUnicode

  • If you do not specify whether you need UCS-2 (2-byte Unicode) or UCS-4 (4-byte Unicode) ( see above ), we will provide a Squish package with Python configured for UCS-2 for Windows and UCS-4 for Linux.

To test for UCS-2 and UCS-4 execute the following in the respective Python installation:

Execute in Python:
Execute in cmd.exe or a shell:

Changing the Python installation used by Squish binary packages

You can change which Python installation a Squish binary package is using by adjusting the path of the Python installation to be used by Squish binary packages. This information is stored in the file SQUISHDIR/etc/paths.ini.

On Linux

Warning
You must have the library version of the respective Python version installed, too. For example, for Python 2.7 the packages python2.7 and libpython2.7 must be installed.
Python UCS-2 (2-byte) vs. UCS-4 (4-byte Unicode)
Please note the Requirements regarding 2-byte vs. 4-byte Unicode.

Change the highlighted parts shown below in the SQUISHDIR/etc/paths.ini file's LibraryPath and Scripting/PythonHome entries from...

LibraryPath = "@(SQUISH_PREFIX)/lib:@(SQUISH_PREFIX)/tcl/lib:@(SQUISH_PREFIX)/python/lib:@(SQUISH_PREFIX)/perl/lib/5.8.8/x86_64-linux/CORE:@(SQUISH_PREFIX)/ruby/lib"

Scripting/PythonHome = "@(SQUISH_PREFIX)/python"

...to...

LibraryPath = "@(SQUISH_PREFIX)/lib:@(SQUISH_PREFIX)/tcl/lib:MY_PYTHON_LIB:@(SQUISH_PREFIX)/perl/lib/5.8.8/x86_64-linux/CORE:@(SQUISH_PREFIX)/ruby/lib"

Scripting/PythonHome = "MY_PYTHON"

MY_PYTHON_LIB stands for the parent directory of the "lib" folder that contains the "python2.x" folder, typically /usr/lib (or /usr/lib64) on Linux systems.

MY_PYTHON stands for the parent directory of the "bin" folder that contains the "python" binary or link, typically "/usr" (because /usr/bin contains the "python" binary or link) on Linux systems.

On Mac OS X 10.9 and higher

You can use the install_name_tool command line tool to change the squishrunner to use Python 2.7. The install_name_tool is part of the command line developer tools and Xcode.

If you don't have the command line developer tools or Xcode installed, you have to install it first. For this, please open Terminal.app and simply enter install_name_tool - this opens a dialog that let you choose to install the command line developer tools or Xcode.

You can then change the squishrunner to use Python 2.7. For this, please open Terminal.app and enter the following:

In Terminal.app

(Replace <SQUISH_DIR> accordingly.)

Change the highlighted parts shown below in the SQUISHDIR/etc/paths.ini file's LibraryPath entry from...

LibraryPath = "...:/System/Library/Frameworks/Python.framework/Versions/2.5:..."

...to...

LibraryPath = "...:/System/Library/Frameworks/Python.framework/Versions/2.7:..."

...and the Scripting/PythonHome entry from...

Scripting/PythonHome = "/System/Library/Frameworks/Python.framework/Versions/2.5"

...to...

Scripting/PythonHome = "/System/Library/Frameworks/Python.framework/Versions/2.7"

When using TextEdit make sure to save the file in Plain Text format by choosing Format > Make Plain Text. (If the Format menu shows Make Rich Text the file will be saved in Plain Text format.)

This change may cause warnings such as the following to be displayed in the Runner/Server Log:

sys:1: RuntimeWarning: Python C API version mismatch for module test: This Python has API version 1013, module test has version 1012.

In our experience these warnings are harmless.

Now this copy of squishrunner is configured to use Python 2.7.

On Mac OS X prior to 10.9

The following instructions apply to Squish 4.1 and earlier only. For Squish 4.2 or higher you need a Squish package that was built with Python 2.5 or higher to be able to use the solution described below. Please contact Squish support to obtain such a Squish package.

Change the highlighted parts shown below in the SQUISHDIR/etc/paths.ini file's LibraryPath entry from...

LibraryPath = "...:/System/Library/Frameworks/Python.framework/Versions/2.5:..."

...to...

LibraryPath = "...:/System/Library/Frameworks/Python.framework/Versions/2.7:..."

When using TextEdit make sure to save the file in Plain Text format by choosing Format > Make Plain Text. (If the Format menu shows Make Rich Text the file will be saved in Plain Text format.)

This change may cause warnings such as the following to be displayed in the Runner/Server Log:

sys:1: RuntimeWarning: Python C API version mismatch for module test: This Python has API version 1013, module test has version 1012.

In our experience these warnings are harmless.

On Windows

Step 1: Change the highlighted parts shown below in the SQUISHDIR\etc\paths.ini file's LibraryPath and Scripting/PythonHome entries from...

LibraryPath = "@(SQUISH_PREFIX)/bin;@(SQUISH_PREFIX)/tcl/bin;@(SQUISH_PREFIX)/python;@(SQUISH_PREFIX)/perl/bin;@(SQUISH_PREFIX)/ruby/bin"

Scripting/PythonHome = "@(SQUISH_PREFIX)/python"

...to...

LibraryPath = "@(SQUISH_PREFIX)/bin;@(SQUISH_PREFIX)/tcl/bin;MY_PYTHON;@(SQUISH_PREFIX)/perl/bin"

Scripting/PythonHome = "MY_PYTHON_LIB"

Here MY_PYTHON and MY_PYTHON_LIB must be replaced with the appropriate paths to your Python installation — for example, C:/Python27 and C:/Python27 (or use double backslashes)

Step 2: Rename...

SQUISH_DIR/lib/python*.dll

...to...

SQUISH_DIR/lib/python*_off.dll

Step 3: Copy...

python*.dll

...from your separate Python installation into...

SQUISH_DIR/lib

Labels:
python python Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.