I ran into a program running a Python program that uses both PyEpics and pvaPy. Here I describe the problem and the solution.
It works fine on Linux:
corvette:iocBoot/iocTomoScan_13BM_PSO/autosave>conda activate base
(base) corvette:iocBoot/iocTomoScan_13BM_PSO/autosave>python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
Imported history from: '/home/epics/.pyhist'
>>> import epics
>>> import pvaccess
>>> epics.caget('13BMD:m1')
-5.250001587314
On Windows it works fine to run PyEpics by itself:
(base) C:\Users\tomo_user>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import epics
>>> epics.caget('13BMD:m1')
-5.250001587314
However, if I also load pvaccess I get this error:
(base) C:\Users\tomo_user>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import epics
>>> import pvaccess
>>> epics.caget('13BMD:m1')
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\epics\ca.py", line 373, in initialize_libca
libca = load_dll(find_libca())
File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\epics\ca.py", line 373, in initialize_libca
libca = load_dll(find_libca())
File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found
[cid:292fe37f-72a4-462e-a05f-674aed70857d]
Matt Newville told me the problem is because PyEpics and pvaPy must load the same version of ca.dll. pvaccess loads this version at import time:
C:\ProgramData\Anaconda3\Lib\site-packages\pvaccess\ca.dll
PyEpics by default loads this version upon the first "real connection":
C:\ProgramData\Anaconda3\Lib\site-packages\epics\clibs\win64\ca.dll
They are not the same and so the error occurs.
However, PyEpics allows setting the environment variable PYEPICS_LIBCA to define the location of ca.dll.
I set it to the same as pvaccess:
set PYEPICS_LIBCA=C:\ProgramData\Anaconda3\Lib\site-packages\pvaccess\ca.dll
and now I can run both PyEpics and pvaPy at the same time:
(base) C:\ProgramData>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import epics
>>> import pvaccess
>>> epics.caget('13BMD:m1')
-5.250001587314
I thought others might find this useful some day.
Mark
- Navigate by Date:
- Prev:
Job opportunity at Sigray David Vine via Tech-talk
- Next:
RE: CS-Studio(Phoebus) Archive Viewer Matlab Export Issue Manoussakis, Adamandios via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
Job opportunity at Sigray David Vine via Tech-talk
- Next:
modbus write registers error to Pilz PLC 高振华 via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|