Python Environment Selection

Description

The Python environment selection feature allows the user to select the Python environment to use for executing the Python code in INI files.

Select the environment by browsing to the directory where it is stored. The user may select a Python virtual environment directory which must have a pyvenv.cfg file in it, or a Python 'base' environment directory which must have a python3.dll file in it. Changes to the Python environment take effect the next time DevWareX is restarted.

Note: For user using a Python virtual environment, it is expected that the “venv” module from the Python standard library is used to create/manage the virtual environments.

And their environment should create with the methods mentioned in the following links,


https://docs.python.org/3.6/library/venv.html

https://docs.python.org/3.6/tutorial/venv.html

https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments

The Toolbar

From menu “Python” in DevWareX, select the desired Python environment.

Python Console: Show or hide the Python Console window with the current Python version and virtual environment name in the title bar.

Use Default Environment: DevWareX will use the oldest version of Python3 available in the system in the next DevWareX restart.

Browse Python Environment: Browse for a Python directory, then DevWareX will use the selected Python environment in the next DevWareX restart.

(Recent Directory Name): DevWareX will use the selected Python environment in the next DevWareX restart.


Note: to restore `sys.argv`, you have to call `PySys_SetArgv`

Like they do here to fix a similar issue: https://github.com/KiCad/kicad-winbuilder/issues/60#issuecomment-403217392

Method documentation:
https://docs.python.org/3/c-api/init.html#c.PySys_SetArgv

Related pages