Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling HyperSpyUI when another instace is active. #130

Open
francisco-dlp opened this issue Apr 15, 2017 · 23 comments
Open

Calling HyperSpyUI when another instace is active. #130

francisco-dlp opened this issue Apr 15, 2017 · 23 comments

Comments

@francisco-dlp
Copy link
Member

Currently calling hyperspyui when an instance is active results in the following:

$ hyperspyui my_file.hdf5
QLocalSocket::connectToServer: Connection refused

Shouldn't it open the file in the current instance instead?

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

Yes it should, the "Connection refused" error is relevant. Which version of Qt/PyQt/PySide are you using?

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

(the relevant file to debug is single_application.py)

@francisco-dlp
Copy link
Member Author

qt 4.8.7, pyqt 4.11.4

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

That should not be a problem. Try increasing SingleApplicationWithMessaging._timeout and see if that changes anything.

@francisco-dlp
Copy link
Member Author

Still refusing with 10000

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

Do you see any log output from the existing instance?

@francisco-dlp
Copy link
Member Author

This is all I get

ERROR:hyperspyui.singleapplication:QLocalSocket::connectToServer: Connection refused
DEBUG:hyperspyui.singleapplication:An existing instance of HyperSpyUI is running, sending arguments to it.

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

PS, this uses a QLocalServer and a QLocalSocket to communicate from the secondary instance to the primary instance. Do you possibly have an interesting network config for localhost?

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

This is all I get [...]

That should be the log output from the new instance of the UI. Is there anything from the existing instance (the one that is running the full UI)?

@francisco-dlp
Copy link
Member Author

No, that one doesn't print anything to the log while attempting to connect.

There is nothing special about my localhost AFAICT.

@francisco-dlp
Copy link
Member Author

It works for me in Windows.

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

Could you download this file and run it from two different terminals? You will need to call it with an extra arg, e.g. python single_app.py test.

It should isolate the problem to a very minimal scenario.

@francisco-dlp
Copy link
Member Author

I get Exiting early!

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

When running the first one?

@francisco-dlp
Copy link
Member Author

No, the first one is fine Loaded app

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

For me, the outputs are:

First:

python single_app.py
Loaded app
<waits here until second app gets run>
["test"]

Second:

python single_app.py test
Exiting early!

@francisco-dlp
Copy link
Member Author

In Windows?

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

Could you check out the basic-CI branch on my repo? It has a test that performs those basic steps, which passes on Travis (#131).

@vidartf
Copy link
Member

vidartf commented Apr 15, 2017

Simply running py.test should do.

@francisco-dlp
Copy link
Member Author

I have not been able to reproduce the issue in my laptop computer which is running Ubuntu (my office computer runs Debian testing). So, you were right, there may be an issue with my OS. I'll check once I get to the office.

@francisco-dlp
Copy link
Member Author

I have boiled down the problem to running hyperspyui as an application in Gnome. I have the following desktop entry:

[Desktop Entry]
Exec=/home/fjd29/anaconda3/bin/hyperspyui %F
Name=HyperSpy UI
Terminal=false
MimeType=application/x-hdf;application/x-dm3;
Icon=/home/fjd29/Python/hyperspyUI/hyperspyui/images/hyperspy.svg
Type=Application
X-MultipleArgs=true
Categories=Science;Physics;DataVisualization;

I only experience the issue when I start HyperSpyUI using this method. If I change Terminal to true I don't experience the issue any more (but I get a terminal with the app, which I don't want). When the issue triggers I have to restart in order to be able to launch hyperspyui from a terminal accepting connections. Killing hyperspyui manually doesn't work, nor login out from the gnome session.

Note: after I manage to integrate hyperspyui successfully in my gnome desktop I'll make a PR.

@vidartf
Copy link
Member

vidartf commented Apr 16, 2017

@francisco-dlp : Could you try to print sys.argv on launch? I think the code might be making some assumptions about the form of that!

@vidartf
Copy link
Member

vidartf commented Apr 16, 2017

No wait, that wouldn't explain the network error :-/

@ericpre ericpre modified the milestones: 1.1.0, 1.2.0 Feb 14, 2019
@ericpre ericpre removed this from the 1.2.0 milestone May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants