IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.
You can find information on setting up PyCharm at https://www.jetbrains.com/help/pycharm/getting-started.html
Requirements
1.Install IDS peak.
oWindows
The installation of the IDS peak runtime setup is sufficient for the exclusive use of Python. If you also want to use IDS peak Cockpit, you must install the IDS peak standard setup.
oLinux
If you use the archive package (tgz file), you must execute the {ARCHIVE_INSTALL_ROOT}/local/scripts/ids_install_udev_rule.sh script with administrator privileges (sudo) to set the appropriate permissions for USB access.
Without the udev rules you have to execute the scripts with sudo -E LD_LIBRARY_PATH=... python3 script.py (-E to obtain the environment, but this does not work for the LD_LIBRARY_PATH).
2.Install the Python bindings for IDS peak.
Creating a project
|
PyCharm uses a "virtual environment" for Python, which isolates the environment from the system or user installation.
|
1.Open PyCharm.
2.Create a new project in PyCharm.
Fig. 275: New project in PyCharm
3.Replace the automatically created main.py e.g. with the quick start example of the ids_peak package or with your own code.
4.Linux: Edit the project configuration.
a.Open the "main" drop-down menu at the top right of the main bar.
b.Select the "Edit Configurations" entry.
Fig. 276: Edit configuration
c.Under "Environment variables", add the information on GENICAM_GENTL32_PATH and/or GENICAM_GENTL64_PATH.
d.Click on the list icon on the right side of the text field to open the list editor.
e.Click on the plus symbol at the top left to enter another environment variable.
oExample Debian package for 64-bit systems: Name "GENICAM_GENTL64_PATH" and value "/usr/lib/ids/cti/"
oExample archive package for 64-bit systems: Name "GENICAM_GENTL64_PATH" and value "{ARCHIVE_INSTALL_ROOT}/lib/ids/cti/" |
5.Install the IDS peak Python bindings.
a.Click on the terminal icon in the left bar at the bottom of the window to open an input terminal within the virtual environment.
b.Enter the following command to install the IDS peak Python bindings:
python -m pip install ids_peak_ipl ids_peak ids_peak_afl
c.If you use a proxy server, you must specify the proxy server directly after "pip install":
python -m pip install --proxy <IP address>:<port number> ids_peak_ipl ids_peak ids_peak_afl
Alternative procedure via package manager.
a.Click on the Python packages icon in the left bar at the bottom of the window.
b.Open the "Add Package" drop-down menu.
c.Select the "From Disk" entry.
d.Enter the path to the Python binding. |
|
6.After the packages have been successfully installed, click on the run icon in the top right of the main bar to execute the script.
Possible error sources under Linux
Possible cause:
•The corresponding binding was not installed: Install the missing binding (see above).
•Python was started with sudo and does not find the packages.
oExecute the ids_install_udev_rule.sh script with sudo, then you do not need to start Python with sudo.
oAlternative: Start Python with sudo -E |
Possible cause:
•You use the installation via archive package (tgz file) and the LD_LIBRARY_PATH path is not set correctly.
oUse the call with LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{ARCHIVE_INSTALL_ROOT}/lib python3 script.py
oAlternative: Edit the project configuration with PyCharm (see above). |
Possible cause:
•The permissions for USB access are missing.
oExecute the ids_install_udev_rule.sh script with sudo.
oAlternative: Start the script with sudo. |