EPICS Controls Argonne National Laboratory

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  2017  2018  <20192020  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  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Callback error from pyepics and python with GUI development
From: Matt Newville via Tech-talk <[email protected]>
To: Tong Zhang <[email protected]>
Cc: "Chabot, Daron" <[email protected]>, "[email protected]" <[email protected]>
Date: Thu, 11 Apr 2019 21:21:30 -0500


On Thu, Apr 11, 2019 at 5:52 PM Tong Zhang <[email protected]> wrote:
Hi Matt,

I think the following issue I encountered may have something to do with
pyepics, which after discussing with Daron, still cannot be resolved yet.

I'm trying to create pv callbacks onto my high-level GUI application
with pyepics, but the app crashed because of the error regarding the CA
context, please see the attached screenshot. And the strange thing is
this only happened to Python 3.5, not Python 3.6 and Python 3.7.


Well, isn't the obvious solution to not use Python 3.5?  

For sure, you are probably better off not using system Python if you can possibly avoid it.   

I have no idea why you might be seeing the exception message that you include in the attached image. You did not include any code or the full traceback. Please provide a complete, minimal example of code that shows the problem you are seeing, and give the full traceback.    

To my understanding, the GUI case is slightly different than python
thread, the main thread is for UI rendering, all my created callback are
spawned from this main thread, I can do other CA action (put/get)
without any problem, so where is the default CA context in the GUI case?


Different GUI toolkits act differently in how they work with CA threads and callbacks (this is probably not limited to using Python -- the C++ event loop for the GUI and the C++ event loop for CA have to know how to work together).   The solution almost certainly depends on which GUI toolkit you are using.  You did not tell us what toolkit you are using.

I've checked this link
https://github.com/pyepics/pyepics/issues/68#issuecomment-290892241 and
the guideline for python thread with pyepics, but still not sure how can
I make use of the context.

Are you disconnecting and reconnecting PVs in different threads?  If not, I don't know why that issue would be relevant.   If you are doing that, I suggest not doing that.

--Matt Newville 

References:
Callback error from pyepics and python with GUI development Tong Zhang via Tech-talk

Navigate by Date:
Prev: Re: Re: Stream device character parse 吴煊 via Tech-talk
Next: Re: Somebody using PROFINET? Florian Feldbauer 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Callback error from pyepics and python with GUI development Tong Zhang via Tech-talk
Next: Re: Callback error from pyepics and python with GUI development Tong Zhang 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  <20192020  2021  2022  2023  2024 
ANJ, 12 Apr 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·