Skip to main content

Create Session

adminAbout 2 min

Create Session.vi

Create a new Python session, which can execute python.exe in a process. This subVI can be switched into python or anaconda version. This can make python run on system python or anaconda environment. Some terminals for Create Session(Python).vi and Create Session(Anaconda).vi are different and will be introduced separately in this page.

You can also wire a python script (.py) path to this subVI. Python session will run this script after the process creates. Then you can use Call Py Method.vi to call functions in this scripts at any time. If python script (.py) path is not wired, the python process will be executed without loading any modules. But you still can pass python command string by EXEC CMD.vi. The python console will be shown by default. You can hide python console by wiring Console Visibility Terminal.

Create Session(Python).vi

pykit-for-labview.lvlib:Create Session.vi
pykit-for-labview.lvlib:Create Session.vi
type
descriptions
cpathPython Execute Path (.exe) (default use system python)
absolute path to the python.exe to execute. Leave it into blank if you want to use system python.
cstr_dummy
No any effects. Just in order to fit "Create Session(Anaconda).vi" terminal.

Create Session(Anaconda).vi

pykit-for-labview.lvlib:Create Session.vi
pykit-for-labview.lvlib:Create Session.vi
type
descriptions
cpathAnaconda3 folder Path
Absolute path to Anaconda3 folder. By default, it will be installed in C:/users/username/Anaconda3/. If the Anaconda3 installation path is not changed, you can leave this terminal blank. Otherwise, this terminal must be wired.
cstrConda Environment Name (required)
The conda environment name. This subVI will find the python interpreter by the conda environment name.

Universal terminals

type
descriptions
cenumConsole Visbility
Show(default): create the session and show console
Hide: create the session without showing console
cpathModule Path (.py)
Absolute path to the python script (.py) file to import.
cu16LvLink Server Port
Asign the LV-Link server port number to remote LabVIEW VI from Python.

Some popular port number (less than 1024) should be avoided.
If port number including 0, 80, 443, 8080 is asigned, the server will not start.
type
descriptions
cdatavalrefPykit Session
specifies a reference to the Python session.
ierrcodeclsterror out
error in can accept error information wired from VIs previously called. Use this information to decide if any functionality should be bypassed in the event of errors from other VIs. Right-click the error in control on the front panel and select Explain Error or Explain Warning from the shortcut menu for more information about the error.
Last update:
Contributors: ZHUO DIAO