Skip to content

P4P on Windows loads ca.dll on import, breaking pyepics #205

Description

@newville

On Windows, at least the current PyPI version, import p4p with

import p4p

or

from p4p.client.thread import Context

silently import ca.dll from epicscorelibs. Since there can only be one shared library per process, this breaks any downstream library that would also import ca.dll. By default, pypepics bundles and uses ca.dll, so that if p4p is imported as above, that script is likely to fail to use pyepics.

Note 1: loading of ca shared library does not happen at import-time on Linux/macOS, making the behaviour of p4p inconsistent.

Note 2: this is not an issue with epicscorelibs or pvxslibs, only with p4p:

>>> import epicscorelibs, epicscorelibs.path, pvxlibs.path, numpy
>>> import epics
>>> epics.caget('TestPV.VAL')

works as expected and does not give the error "loading CA DLL failed".

I think that P4P should not load CA.dll at import time, and it should work consistently on all platforms.

On all platforms, pyepics supports setting the location of LIBCA after import but before any real work is done. It supports using the environment variable PYPEPICS_LIBCA to specify the location of LIBCA. If this is not set, it will use the ones it installs for itself. We can work around this error in P4P, but you should fix this and not import LIBCA at import p4p.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions