Skip to content

BUG: Access Violation error when importing PySide2 and pypylon #858

@Charlie-Warren

Description

@Charlie-Warren

Describe the issue:

On pypylon versions 4.1.0 and 4.2.0, if you import PySide2 before pypylon, then running EnumerateDevices crashes with no error information.

import PySide2
from pypylon import pylon

tlFactory = pylon.TlFactory.GetInstance()
devices = tlFactory.EnumerateDevices()

print("Devices: ", devices)

Therefore "Devices: ..." never gets printed, it crashes before that line.

To access a return code, I converted the above code to a string and used subprocess.run():

import sys
import subprocess

code = '''
import PySide2
from pypylon import pylon

tlFactory = pylon.TlFactory.GetInstance()
devices = tlFactory.EnumerateDevices()

print("Devices: ", devices)
'''
ret = subprocess.run([sys.executable, '-c', code])
print(ret.returncode)

This gave error code 3221225477, or 0xc0000005 in hex, an access violation error

  • I tested this with the latest version of PySide2, version 5.15.2.1
  • The error occurred when I used pypylon 4.1.0 and 4.2.0, but not when I used 4.0.0
  • The error doesn't seem to occur if you import PySide2 after pypylon

Reproduce the code example:

import PySide2
from pypylon import pylon

tlFactory = pylon.TlFactory.GetInstance()
devices = tlFactory.EnumerateDevices()

print("Devices: ", devices)

Error message:

It crashes with no error message

Is your camera operational in Basler pylon viewer on your platform

Yes

Hardware setup & camera model(s) used

X86
Windows 10
32GB DDR4

You do not need a camera connected to encounter this error, but I used a daA1920-160um

Runtime information:

python: 3.10.0 (default, Oct 17 2021, 23:51:15) [MSC v.1929 64 bit (AMD64)]
platform: win32/AMD64/10
pypylon: 4.2.0 / 10.2.1.471

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions