nicost / micro-manager

Microscope control and image acquisition integrated with ImageJ.
http://www.micro-manager.org
16 stars 11 forks source link

Fix for accessing mmcorej classes #93

Closed henrypinkard closed 4 years ago

nicost commented 4 years ago

Merged. Can you rebase on my zmq branch? There seem to be merge conflicts every-time that I need to resolve manually.

henrypinkard commented 4 years ago

Done. Also just pushed to Pygellan bug fix for calling two methods with same name but different arg numbers (e.g. setExposure("Camera", 100) and setExposure(100))

nicost commented 4 years ago

With the latest code, the first command from pygellan succeeds, but afterwards only get errors:

from pygellan.acquire import PygellanBridge
bridge = PygellanBridge()
mm=bridge.get_studio()
mmc=bridge.get_core()
mm.live().snap(True)
[JavaObjectShadow for : org.micromanager.data.internal.DefaultImage]
mm.live().snap(True)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/Users/nico/git/Pygellan/pygellan/acquire.py", line 211, in _translate_call
    self._socket.send(bytes(json.dumps(message), 'utf-8'))
  File "/Users/nico/anaconda3/envs/Pygellan/lib/python3.7/site-packages/zmq/sugar/socket.py", line 400, in send
    return super(Socket, self).send(data, flags=flags, copy=copy, track=track)
  File "zmq/backend/cython/socket.pyx", line 728, in zmq.backend.cython.socket.Socket.send
  File "zmq/backend/cython/socket.pyx", line 769, in zmq.backend.cython.socket.Socket.send
  File "zmq/backend/cython/socket.pyx", line 135, in zmq.backend.cython.socket._check_closed
zmq.error.ZMQError: Socket operation on non-socket

Any ideas?

nicost commented 4 years ago

This is definitely at the Python side. Reverting to 1d726702620ee6efb2f950aa9790e3bb28f0c972 fixes this for me...

henrypinkard commented 4 years ago

Fixed in latest PR. Was a bug that was trying to double close sockets in destructors. There are corresponding changes in Pygellan too.

It might make our workflow easier if you fork Pygellan also so I can PR both repositories to you when I make changes