ericmandel / pyds9

Python connection to SAOimage DS9 via XPA
76 stars 41 forks source link

Reduce the number of false messages about DS9 already running when starting xpans #97

Closed DougBurke closed 4 years ago

DougBurke commented 4 years ago

This attempts to make the check for an already-running DS9 process a bit more robust. It's not ideal, and will not work on Windows (but the existing code doesn't either), but is hopefully an improvement.

My current test set up doesn't let me test this (I don't have the time/energy to change my environment to address this).

DougBurke commented 4 years ago

@ericmandel can you try this out and see if it works. Then we can decide if its okay or needs a rework.

ericmandel commented 4 years ago

Sure but can you please remind me how to install your trial version? I clone it but when I do:

pip3 install pyds9

in the clones directory, it downloads my repository, not the one I am sitting in. Frustrating!

ericmandel commented 4 years ago

Oh wait, I tried:

pip3 install ./pyds9

which might be doing something better ...

DougBurke commented 4 years ago

I tend to create a new conda environment, and then install into that (or use develop mode). I'm not sure what you're environment is, so I don't want to accidentally break things. I think that

pip3 install -e .

(when in the pyds9/ directory) eg https://stackoverflow.com/questions/42609943/what-is-the-use-case-for-pip-install-e can be useful here

ericmandel commented 4 years ago

This code change works for me in the following situations:

  1. no DS9 and no xpans running, it no longer erroneously prints the DS9_EXISTS message. Yeah!
  2. DS9 and xpans running, it does not print the message, which is correct. Yeah!
  3. DS9 running, xpans not running, it prints the message and after you follow the instructions, the right connection is made. Yeah!
  4. DS9 not running and xpans running, does not print the message, which is correct. Yeah!

There is a print statement in the code that you will want to remove:

print("- checking [{}]".format(pline, idx))

cause it prints about a billion lines on my Mac. Other than that, thanks, this should be great.

DougBurke commented 4 years ago

Doh. I thought I'd taken out the debug statement.

DougBurke commented 4 years ago

I've just force-pushed a change so that the debug line never existed.

ericmandel commented 4 years ago

Thanks, I merged it and now will test it as a new user ...

ericmandel commented 4 years ago

Still works, I think we have winner here ... thanks.