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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: pyepics not updating pv.enum_strs after connection |
From: | Matt Newville <[email protected]> |
To: | Jameson Graef Rollins <[email protected]> |
Cc: | EPICS tech-talk <[email protected]> |
Date: | Thu, 19 Mar 2015 23:19:04 -0500 |
On Thu, Mar 19 2015, Matt Newville <[email protected]> wrote:
> I'm not certain I can tell what you did, but I'll guess that you created a
> PV, set a callback, and are trying to run pv.get_ctrlvars() inside the
> callback. That won't work, basically because the get_ctrlvars() would have
> to do an Epics poll(), and inside a callback you're already "inside" an
> Epics poll().
>
> But you can create a PV, get the ctrl vars, and then set a callback, or
> allow that the first few calls in the callback may not have the enum
> strings. I typically do this as
> pv = PV(pvname)
> pv.get(as_string=True) # make sure it's connected, has a value, and
> has CTRL values
> pv.add_callback(....)
The tricky bit is that for this application I do *not* want to connect
to the PV when it's being created, and I want all updates to happen from
the callbacks. This is for a gui application that is connecting to many
PVs asynchronously. Waiting for each individual PV to connect at
start-up would slow down the start up time considerably. For this
application there's really no other time when the value can be retrieved
"as_string" so that enum_strs is updated without having to bring the
user into the process somehow (at least I have yet to figure out how).
Is there really no other option?
I still don't understand why the
enum_strs attribute can't just be updated automatically when the
connection is first made, without having to retrieve it manually at some
point. It would certainly make things easier from my perspective.