Hi Matt,
Yes, the outputs are same from both terminal & jupyter.
I am wondering something wrong with Mac or safari. I had no problem with the same script on my linux box.
Here is output from my terminal:
>>> print(epics.ca.find_libca())
/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/clibs/darwin64/libca.dylib
>>> chan = epics.ca.create_channel('test')
>>> conn = epics.ca.connect_channel(chan)
>>> print("Connected ", chan, conn== epics.dbr.CS_CONN)
Connected c_long(140696518603264) False
>>> val = epics.ca.get(chan)
>>> print(val)
5.6
And output from jupyter notebook:
print(epics.ca.find_libca())
chan = epics.ca.create_channel('test')
conn = epics.ca.connect_channel(chan)
print("Connected ", chan, conn== epics.dbr.CS_CONN)
val = epics.ca.get(chan)
/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/clibs/darwin64/libca.dylib
Connected 140535502249016 False
/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/ca.py:1306: UserWarning: ca.get('test') timed out after 1.00 seconds.
warnings.warn(msg % (name(chid), timeout))
Thanks,
Guobao
Hi Guobao,
On Tue, May 15, 2018 at 10:36 AM, Shen, Guobao <[email protected]>
wrote:
Hi,
I am using PyEPICS 3.3.1 together with my conda3 + Python 3.6.
In my terminal, I have no problem to do for example epics.caget().
However, I always get a time out problem in my jupyter notebook when using PyEPICS.
The error message is like:
anaconda3/lib/python3.6/site-packages/epics/ca.py:1306: UserWarning: ca.get('test') timed out after 5.00 seconds.
warnings.warn(msg % (name(chid), timeout))
Is there any environment variable I should set?
Hm, maybe. Perhaps the Jupyter kernel has different environmental variables set for how it finds the CA shared library, and how it searches for PVs?
Getting that far suggest that a) the CA shared library was found and initialized, b) that the channel was found and connected, c) that a `ca_array_get_callback()` was called and did not return a SEVCHK error, but that the program gets stuck waiting for the
get callback to actually run. The 5 second timeout for get() on a connected channel seems plenty long enough.
We might need a little bit more information to go on. First, can you verify that doing
import epics
print(epics.ca.find_libca())
gives the same libca as when running python from the Terminal?
chan = epics.ca.create_channel('test')
conn = epics.ca.connect_channel(chan)
print("Connected ", chan, conn== epics.dbr.CS_CONN)
do you really see that the channel is connected? Do you get the same results from running python in the Terminal?
With cothread, I do not have the same issue, therefore, it does not sound like a general EPICS CA variable problem.
I'm not sure. It may be that cothread does not always do `ca_array_get_callback()` and then expect that the callback will be called. I don't know why that would cause a problem from Jupyter
for you.