Skip to content

Virtual environment incompatibilty #138

@felmoreno1726

Description

@felmoreno1726

Currently, the package is installed incorrectly for Virtual Environments where the Python interpreter version is different from the system-wide Python version.

Unexpected behavior

If global interpreter is python3.13, but virtual environment is python3.12:

wsdl_dst_dir will be lib/site-packages/python3.13, but the required location in which the library expects it to be is
lib/site-packages/python3.12

This is because the setup.py script references the system-wide sys version.

https://github.com/FalkTannhaeuser/python-onvif-zeep/blob/7c92b341dc8a08f71d5c1411a29466a3cda7c064/setup.py#L32C1-L36C7
wsdl_dst_dir = 'Lib/site-packages/wsdl' if sys.platform == 'win32' else \ 'lib/python%d.%d/site-packages/wsdl' % (sys.version_info.major, sys.version_info.minor)

This produces an error when attempting to use the library.

Stack trace

mycam = ONVIFCamera(ip_address, port, username, password, transport=transport)

...

<project-path>/.venv/lib64/python3.12/site-packages/onvif/client.py", line 292, in get_definition
    raise ONVIFError('No such file: %s' % wsdlpath)
onvif.exceptions.ONVIFError: Unknown error: No such file: <project-path>/.venv/lib64/python3.12/site-packages/wsdl/devicemgmt.wsdl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions