Closed kdmarchuk closed 4 years ago
Also, just tried running some other scripts in my Spyder editor
self.bridge = MagellanBridge()
self.core = self.bridge.get_core()
print('MicroManager Socket:')
print(self.core.socket)
AttributeError: 'MMJavaClass' object has no attribute 'socket'
Regarding editor, I highly recommend PyCharm
That error looks like it has to do with the code that changes the names of functions from camelCase to under_scored, but I would need to be able to reproduce it to fix (i.e. cause it to happen from script)
I don't understand the code you posted in your second comment. Why are you trying to access the socket
?
Cool. I'll try PyCharm next.
I use the socket connection to remind myself to launch Micro Manager and Magellan first before running my script. Was probably going to add some error handling there.
My point was that I used to be able to print the socket connection, and now that's not working. Sorry I was rushing off and wanted to add the comment.
I had changed the name of socket
to _socket
to make it clear that it's an internal variable. Not a good idea to rely on it because your code could break if I change an internal detail.
In theory you should be able to launch your script before MM, and it will just hang until the server starts up. Though if you try to do any of the magellan-specific stuff youll likely get an error if you haven't yet opened magellan
Okay. Noted.
To prevent hanging do you have a preferred 'connection test'? I'd eventually like to pop up a warning dialog that says something like, 'reminder to launch Micro Manager' or something.
Thanks, Kyle
Maybe you could directly check if the micro-manager is running
https://thispointer.com/python-check-if-a-process-is-running-by-name-and-find-its-process-id-pid/
Hi Henry,
Just tried to run my simple Pygellan script in PyCharm. I'm getting the same errors as VS code.
Can you post your code and which version of python you're using?
from pygellan.acquire import MagellanBridge
bridge = MagellanBridge()
magellan = bridge.get_magellan()
core = bridge.get_core()
exposure = core.get_exposure()
print(exposure)
Python 3.7, Pygellan 0.0.5, MM 2.0.0-gamma nightly 20190909
Fixed by https://github.com/henrypinkard/Pygellan/commit/19f0f7067a23a033977b54454d87b94f48c4228b
Uploaded pygellan 0.0.6 with fix added
Hi Henry,
Tried to run a simple script with the new Pygellan and last night's MicroManager build. In my VS code editor the simple script caused an endless output of the errors seen in the screen shot (had to screen shot as killing the terminal clears the errors and they were flying by too fast to read).
If I run the code in my Spyder editor, it runs fine. The main issue for me personally is that I had to switch from Spyder to VS code due to different error happening specifically in Spyder. Running out of editors...
Anyways, let me know if it's fixable, or I'll hunt for another editor.
Kyle