Closed kiotex closed 2 years ago
Hi @kiotex and thank you for pointing that out.
This is actually a known issue and comes from the fact that all references/objects returned from the qudi process into the IPython kernel are actually rpyc
references (rpyc.core.netref
type). This is necessary because your IPython session (e.g. jupyter notebook or the qudi manager console) is a separate process and is communicating with the qudi process via rpyc
.
While that circumstance in itself is not so bad, IPython has some very weird (and undocumented) formatting machinery for printing the output cell.
One can currently avoid the isssue by explicitly printing the returned object instead of relying on the IPython output mechanics. So instead of:
In[1]: laser_dummy.on()
This here should work instead:
In[1]: print(laser_dummy.on())
However:
I just pushed a workaround to main
that should avoid this printing issue by disabling the IPython output formatter entirely. So all outputs cells should be equivalent to a call to print
.
Could you please check if this resolves the issue for you?
But there are still things that can go wrong when using an interactive IPython session. rpyc
, numpy
and jupyter
/IPython
are very incompatible and care needs to be taken when working in a notebook/the qudi console.
There is currently no perfect solution to this isssue out there as far as I know.
Thanks a lot, @Neverhorst
I just pushed a workaround to main that should avoid this printing issue by disabling the IPython output formatter entirely. So all outputs cells should be equivalent to a call to print. Could you please check if this resolves the issue for you?
It seems to work I expect.
You're welcome @kiotex. I will close this issue.
@kiotex Unfortunately, I had to undo this fix again. A side effect of the whole thing was that plotting in jupyter notebooks was not possible anymore.
So please use the workaround I posted above with calling print()
explicitly.
IPython is a mess and I can not find any way to avoid these errors selectively.
Version
current main
What is affected by the bug?
When I run a command that returns with an enum type such as
on()
in simple_laser_dummy.py in qudi-iqo-modules on the ipython console, I get a type error.This error message was displayed repeatedly.
When does the bug occur?
load simple_laser_dummy.py in qudi-iqo-modules modules in qudi. Execute a
on()
command.Infometion of environment
How do we replicate the issue?
Changing the variable type attribute to int type or something when returning message from qudi to ipython console, I could avoid this problem for the time being.
Expected behavior
Relevant log output
No response
Additional Comments
No response
Contact Details
No response