
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
The official python wrapper for the Basler pylon Camera Software Suite.
Background information about usage of pypylon, programming samples and jupyter notebooks can also be found at pypylon-samples.
Please Note: This project is offered with limited technical support by Basler AG. You are welcome to post any questions or issues on GitHub. For additional technical assistance, please reach out to our official Support team.
pip3 install pypylon
For more installation options and the supported systems please read the Installation paragraph.from pypylon import pylon
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.Open()
# demonstrate some feature access
new_width = camera.Width.Value - camera.Width.Inc
if new_width >= camera.Width.Min:
camera.Width.Value = new_width
numberOfImagesToGrab = 100
camera.StartGrabbingMax(numberOfImagesToGrab)
while camera.IsGrabbing():
grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
if grabResult.GrabSucceeded():
# Access the image data.
print("SizeX: ", grabResult.Width)
print("SizeY: ", grabResult.Height)
img = grabResult.Array
print("Gray value of first pixel: ", img[0, 0])
grabResult.Release()
camera.Close()
from pypylon import pylondataprocessing
import os
resultCollector = pylondataprocessing.GenericOutputObserver()
recipe = pylondataprocessing.Recipe()
recipe.Load('dataprocessing_barcode.precipe')
recipe.RegisterAllOutputsObserver(resultCollector, pylon.RegistrationMode_Append);
recipe.Start()
for i in range(0, 100):
if resultCollector.GetWaitObject().Wait(5000):
result = resultCollector.RetrieveResult()
# Print the barcodes
variant = result["Barcodes"]
if not variant.HasError():
# Print result data
for barcodeIndex in range(0, variant.NumArrayValues):
print(variant.GetArrayValue(barcodeIndex).ToString())
else:
print("Error: " + variant.GetErrorDescription())
else:
print("Result timeout")
break
recipe.Unload()
The current pypylon implementation allows direct feature assignment:
cam.Gain = 42
This assignment style is deprecated with pypylon 3.0.0, as it prevents full typing support for pypylon.
The recommended assignment style is now:
cam.Gain.Value = 42
To identify the locations in your code that have to be updated, run with enabled warnings:
PYTHONWARNINGS=default python script.py
Please note that the pylon Camera Software Suite may support different operating system versions and features than pypylon. For latest information on pylon refer to: https://www.baslerweb.com/en/software/pylon/ In addition, check the release notes of your pylon installation. For instance:
The easiest way to get pypylon is to install a prebuild wheel. Binary releases for most architectures are available on pypi**. To install pypylon open your favourite terminal and run:
pip3 install pypylon
The following versions are available on pypi:
3.9 | 3.10 | 3.11 | 3.12 | 3.13 | |
---|---|---|---|---|---|
Windows 64bit | x | x | x | x | x |
Linux x86_64* | x | x | x | x | x |
Linux aarch64* | x | x | x | x | x |
macOS x86_64** | x | x | x | x | x |
macOS arm64** | x | x | x | x | x |
Additional Notes on binary packages:
- (*) The linux 64bit binaries are manylinux_2_31 conformant. This is roughly equivalent to a minimum glibc version >= 2.31. :warning: You need at least pip 20.3 to install them.
- (**) macOS binaries are built for macOS >= 14.0 (Sonoma)
Building the pypylon bindings is supported and tested on Windows, Linux and macOS
You need a few more things to compile pypylon:
sudo apt install python-dev
on linux)pip install "swig==4.3"
To build pypylon from source:
git clone https://github.com/basler/pypylon.git
cd pypylon
pip install .
If pylon SDK is not installed in a default location you have to specify the location from the environment
export PYLON_ROOT=<installation directory of pylon SDK>
export PYLON_FRAMEWORK_LOCATION=<framework base folder that contains pylon.framework>
Pull requests to pypylon are very welcome. To help you getting started with pypylon improvements, here are some hints:
python setup.py develop
This will "link" the local pypylon source directory into your python installation. It will not package the pylon libraries and always use the installed pylon.
After changing pypylon, execute python setup.py build
and test...
NOTE: The unit tests try to import
pypylon....
, so they run against the installed version of pypylon.
pytest tests/....
FAQs
The python wrapper for the Basler pylon Camera Software Suite.
We found that pypylon demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.