EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Is there any support for EPICS for IronPython (or anyone working on it)?
From: Matt Newville <[email protected]>
To: "Hartman, Steven M." <[email protected]>
Cc: "Skorpenske, Harley David" <[email protected]>, EPICS Tech Talk <[email protected]>
Date: Fri, 12 May 2017 15:25:16 -0500
Hi Steven,

On Fri, May 12, 2017 at 1:44 PM, Hartman, Steven M. <[email protected]> wrote:
In follow up to http://www.aps.anl.gov/epics/tech-talk/2016/msg01425.php from last August . . .

The MTS customer referenced was one of the beam lines here at SNS. They are interested in using the IronPython interface included with the new MTS load-frame software to pass parameters to our EPICS beam line control system using PyEpics.

Harley (cc’d here but not on tech-talk) gave it a try . . .

>>> from epics import caget
>>> beampower = caget('RTBT_Diag:BCM25I:Power60')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\Lib\site-packages\epics\__init__.py", line 81, in caget
  File "C:\Python27\Lib\site-packages\epics\pv.py", line 39, in get_pv
  File "C:\Python27\Lib\site-packages\epics\ca.py", line 359, in wrapper
  File "C:\Python27\Lib\site-packages\epics\ca.py", line 239, in initialize_libca
AttributeError: 'ArrayType' object has no attribute 'in_dll'

>>> beampower = caget('RTBT_Diag:BCM25I:Power60')
cannot connect to RTBT_Diag:BCM25I:Power60
>>>


The first call to pyepics from IronPython always gives the AttributeError; all subsequent calls give “cannot connect”.

Regular C Python 2.7 was used to install PyEpics using the installer exe. On the same host, it can successfully connect and read the same PV so not likely to be a network or access permission issue.

Tested with . . .
IronPython 2.7.7 (2.7.7.0) on .NET 4.0.30319.42000
32-bit and 64-bit


Any suggestions?

Thanks,
--
Steven Hartman
[email protected]





 
I think the answer to the question in the subject line is: no one is working on this. But that's not a deliberate lack of support, and it doesn't mean it can't be done.   I think it's just that no one has needed to do this, yet.

PyEpics needs to load the CA library (ca.dll)  for all CA communication.  It does this using the ctypes library, which is (mostly) cross-platform.   My understanding is that it is available for IronPython, and the message implies it is partially working.

The error message from the function `initialize_libca` in ca.py means that this initial connection to ca.dll is where the problem is.  It looks like the DLL is found and loaded, and that at least some interaction with the DLL works, but that it fails doing:
 
     dbr.value_offset = (39*ctypes.c_short).in_dll(libca, 'dbr_value_offset')

which is a ctypes Array trying to look inside the DLL (held in `libca`) for a particular value that's needed to unpack some of the CA data structures. The message looks like it's saying that ctypes Arrays don't have an `in_dll` method.   I don't know why *that* is. 

From the perspective of  "could pyepics ever work in IronPython", I'd say this is a pretty encouraging report -- it definitely didn't fail loading ca.dll!   If the error with `in_dll` is the only problem, the solution is probably pretty easy. But, there might be other challenges with ctypes too, and it might take some work to get it to work fully.
 

--Matt Newville

Replies:
RE: Is there any support for EPICS for IronPython (or anyone working on it)? freddie.akeroyd
References:
Re: Is there any support for EPICS for IronPython (or anyone working on it)? Hartman, Steven M.

Navigate by Date:
Prev: Re: Is there any support for EPICS for IronPython (or anyone working on it)? Hartman, Steven M.
Next: RE: Is there any support for EPICS for IronPython (or anyone working on it)? freddie.akeroyd
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Is there any support for EPICS for IronPython (or anyone working on it)? Hartman, Steven M.
Next: RE: Is there any support for EPICS for IronPython (or anyone working on it)? freddie.akeroyd
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024