Closed yzhenggit closed 3 years ago
@yzhenggit , I think get_current_workspace()
won't work because it is trying to return a Python Workspace
object across a network connection. If you just want to display images, try following the examples here.
@ejeschke thanks for your reply! I followed the example you gave, the code stopped at shell.add_channel('Messier')
with a lot of errors... The full error message can be seen here:
ginga_error2.txt. You commented that this is because the RC plugin isn't started in the viewer. How should I fix that? Thanks!
You commented that this is because the RC plugin isn't started in the viewer. How should I fix that?
Do this first:
$ ginga --modules=RC --loglevel=20 --stderr
then try from the grc
module.
Or, start ginga without --modules=RC
then do Plugins->Remote->Remote Control.
I just tested with development (current github) version of Ginga and the example works fine.
I tried the $ ginga --modules=RC --loglevel=20 --stderr
one, the grc module returned the same error. Then I tried to launch ginga without --modules=RC, and click Operation-> Remote-> Remote control [G] (I didn't see the Plugins one). It gives me an error like the following:
Plugin failed to start correctly: [Errno 8] nodename nor servname provided, or not known File "/anaconda3/envs/pypeit/lib/python3.9/site-packages/ginga/gw/PluginManager.py", line 339, in start_plugin_future p_info.obj.start() File "/anaconda3/envs/pypeit/lib/python3.9/site-packages/ginga/rv/plugins/RC.py", line 268, in start self.server.start(thread_pool=self.fv.get_threadPool()) File "/anaconda3/envs/pypeit/lib/python3.9/site-packages/ginga/util/grc.py", line 216, in start self.server = SimpleXMLRPCServer.SimpleXMLRPCServer((self.host, File "/anaconda3/envs/pypeit/lib/python3.9/xmlrpc/server.py", line 605, in init socketserver.TCPServer.init(self, addr, requestHandler, bind_and_activate) File "/anaconda3/envs/pypeit/lib/python3.9/socketserver.py", line 452, in init self.server_bind() File "/anaconda3/envs/pypeit/lib/python3.9/socketserver.py", line 466, in server_bind self.socket.bind(self.server_address)
Any thoughts? Thanks!
Errno 8] nodename nor servname provided, or not known
This is an error I have not seen before. It seems to indicate that it can't open a listening socket on your machine. What platform are you on (Mac/Win/Linux) and what version?
Mac High Sierra v10.13.6
One thing to try. If you are able to start using --modules=RC, then when you open the tab for "RC" you will see something like "localhost:9000". Change it to "127.0.0.1:9010" and press Enter. You should see this value repeated above the box. Press the "Restart" button.
Now from your ipython or jupyter session, use
viewer = grc.RemoteClient('127.0.0.1', 9010)
Let me know what happens. Perhaps an issue with using "localhost"...
When I open ginga with --modules=RC, I actually don't see a RC tab on the top right corner as suggested...
When I open ginga with --modules=RC, I actually don't see a RC tab on the top right corner as suggested...
Ok, I just pushed up a commit that will allow you to set those values in a config file. Can you install from dev version? Then copy this file to your ~/.ginga
folder. Edit it and change the bind_host
to '' (empty string).
Now start up ginga as before and let me know if you see the RC tab show up.
I just checked running default configuration on Mac OS X 11.0.1 ("Big Sur"). No problem bringing up the RC plugin. Probably not a Mac thing then, although I am not sure of the differences between "Big Sur" and "High Sierra"...
good news! Installing from the dev version as you suggested works! I'm able to bring up the RC tab using either ginga --modules=RC
, or ginga
then click through Operation/Remote/Remote Control. I'm going to try a few more things with it and see if I can load my fits files. Thank you so much!
Excellent. For our debugging purposes, did you have to do the hack with the config file or did it just work to install the dev version?
I had to do the hack and change the 'localhost' to '' to get it work.
Thanks, good to know.
@ejeschke thanks for your reply! I followed the example you gave, the code stopped at
shell.add_channel('Messier')
with a lot of errors... The full error message can be seen here: ginga_error2.txt. You commented that this is because the RC plugin isn't started in the viewer. How should I fix that? Thanks!
Hello! So I'm going through this again to try to get ginga display my fits files (now RC is fine). I'm following the example you suggested, but still get the same bug when running this line shell.add_channel('Messier')
. Any advice?
What value are you using for the host from the grc
(python session) side? "localhost", "127.0.0.1" or something else?
Try "127.0.0.1" from that side
what am I supposed to put it there? viewer = grc.RemoteClient('127.0.0.1', 9000)
? I was using localhost
what am I supposed to put it there? viewer = grc.RemoteClient('127.0.0.1', 9000)? I was using localhost
Yes. "localhost" was not working from the server side, so I wouldn't expect it to work from the client side either.
So I did viewer = grc.RemoteClient('127.0.0.1', 9000)
, then 'shell.add_channel('Messier')', it was still the same error
And you did a
shell = viewer.shell()
in between those two, as shown in the example?
Let's find out what actual interfaces are running. In a terminal, can you type
ifconfig -a
Do you see 127.0.0.1 anywhere? If you see some other IP address, use it on the client side instead of 127.0.0.1
And you did a
shell = viewer.shell()
in between those two, as shown in the example?
yes
Let's find out what actual interfaces are running. In a terminal, can you type
ifconfig -a
Do you see 127.0.0.1 anywhere? If you see some other IP address, use it on the client side instead of
127.0.0.1
These are the first few lines of the output after I type ifconfig -a
in a termial:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
Looks like a 127.0.0.1 interface is defined. I'm beginning to think that maybe the Mac firewall is enabled, and you might need to allow "Python" to open an unblocked socket.
Can you check this page and follow down till you see the part about opening System Preferences, Security and Privacy, then click the Firewall tab to view the firewall settings. Is Firewall "on"?
With ginga running with RC open, try this from a terminal:
$ nc -vz 127.0.0.1 9000
(Make sure you are using 9000 on both sides for the port)
Do you get a connection succeeded or failed message?
With ginga running with RC open, try this from a terminal:
$ nc -vz 127.0.0.1 9000
(Make sure you are using 9000 on both sides for the port)
Do you get a connection succeeded or failed message?
Yes, I get a connection succeeded message as the following:
found 0 associations found 1 connections: 1: flags=82<CONNECTED,PREFERRED> outif lo0 src 127.0.0.1 port 49463 dst 127.0.0.1 port 9000 rank info not available TCP aux info available
Connection to 127.0.0.1 port 9000 [tcp/cslistener] succeeded!
Looks like a 127.0.0.1 interface is defined. I'm beginning to think that maybe the Mac firewall is enabled, and you might need to allow "Python" to open an unblocked socket.
Can you check this page and follow down till you see the part about opening System Preferences, Security and Privacy, then click the Firewall tab to view the firewall settings. Is Firewall "on"?
My Firewall was on. I turned it off and tried the example you showed withviewer = grc.RemoteClient('127.0.0.1', 9010)
, which told me ConnectionRefusedError: [Errno 61] Connection refused
. And then I tried viewer = grc.RemoteClient('localhost', 9000)
, which returned an error of gaierror: [Errno 8] nodename nor servname provided, or not known
. Not sure what's going on...
My Firewall was on. I turned it off
I'm not sure, but I think even with the firewall on you should be able to connect to the same machine from itself. But this all depends on the firewall settings. By turning it off, though, you should be able to rule it out as the problem.
gaierror: [Errno 8] nodename nor servname provided, or not known
Searching up this error message is getting us closer to the answer. Could you open a terminal and type
cat /etc/hostname
if that doesn't work you can also use Python
import socket
print(socket.gethostname())
This is the name you should probably use instead of "localhost". Make sure you use the same port number (e.g. 9000) in both sides of the ginga connection.
Hey @ejeschke , it works now! (Had to use the Python option to get my local host name). I was able to get through the example you gave earlier on. Thank you so much!
One last question, do you know if there is a way for me to change the hostname from 'Yong.local' (which is what socket.gethostname() shows me) to 'localhost'? This seems to give me some troubles to use other codes that have ginga implemented as their default viewer. So I wonder if I can change this. Thank you!
The web page I linked to suggested editing /etc/hosts
, if you have one. You could add "localhost" with the IP 127.0.0.1 . If you want to change the official hostname, you can edit /etc/hostname
. There is probably some Apple GUI to do this if you search around under System Preferences ("Settings" ?). Look for something like change host name...
But I wouldn't change the hostname. Just add "localhost" as a name for 127.0.0.1 in /etc/hosts
...
YES! Now everything works (I added 127.0.0.1 localhost to /etc/hosts). Thank you so much!!! @ejeschke I really appreciate your time and patience in helping me get this fixed.
@yzhenggit, you are welcome. I will leave this open a little longer while I check on the status of "localhost" on Mac OS X and Windows. I believe this fairly standard across TCP/IP networking on all platforms, which means it is not a ginga issue, but one of computer network configuration. If it turns out that "localhost" is not standard we will look at figuring out a fix.
Got it, thank you!
Confirmed that Mac OS X and Windows systems normally have "localhost" defined.
Hi all,
I'm running into problems with viewing my images on ginga. I wonder if you could give me some advice on how to proceed. The installed version of ginga is 3.1.0.
I open the ginga window with
ginga --modules=RC
, then do the following in a python session with the following lines:from ginga.util import grc
viewer = grc.RemoteClient('localhost', 9000)
sh = viewer.shell()
tmp = sh.get_current_workspace()
The last line of
tmp***
gives me an error as shown in the attached file. Any thoughts? Thank you so much!ginga_error.txt