imexam
imexam copied to clipboard
WinError 10048: Only one usage of each socket address is normally permitted
I'm trying to use imexam in Jupyter notebook on Windows 10, and on trying to connect to ginga I get a strange socket error:
OSError Traceback (most recent call last)
<ipython-input-2-8bfff7002bf2> in <module>
2 #os.environ['XPA_METHOD'] = "inet"
3
----> 4 viewer = imexam.connect(viewer='ginga')
5 viewer.load_fits('example_data/PAL5_3p6um.fits')
~\anaconda3\lib\site-packages\imexam\connect.py in __init__(self, target, path, viewer, wait_time, quit_window, port)
98
99 elif 'ginga' in self._viewer:
--> 100 self.window = ginga(exam=self.exam,
101 close_on_del=quit_window,
102 port=port)
~\anaconda3\lib\site-packages\imexam\ginga_viewer.py in __init__(self, exam, close_on_del, logger, port, host, use_opencv)
926 self._port = port
927
--> 928 super(ginga, self).__init__(exam=exam, close_on_del=close_on_del,
929 logger=logger, port=self._port)
930
~\anaconda3\lib\site-packages\imexam\ginga_viewer.py in __init__(self, exam, close_on_del, logger, port)
143
144 # create the viewer specific to this backend
--> 145 self._create_viewer(bind_prefs, viewer_prefs)
146
147 # TODO: at some point, it might be better to simply add a custom
~\anaconda3\lib\site-packages\imexam\ginga_viewer.py in _create_viewer(self, bind_prefs, viewer_prefs, opencv, threads)
950 self._threads = threads
951 self._server = None
--> 952 self._start_server()
953
954 self.ginga_view = self._server.get_viewer('Imexam Display')
~\anaconda3\lib\site-packages\imexam\ginga_viewer.py in _start_server(self)
997 no_ioloop = True # jupyter console and notebook
998
--> 999 self._server.start(no_ioloop=no_ioloop)
1000
1001 def _shutdown(self):
~\anaconda3\lib\site-packages\ginga\web\pgw\ipg.py in start(self, use_thread, no_ioloop)
423 ], factory=self.factory, logger=self.logger)
424
--> 425 self.http_server = self.server.listen(self.port, self.host)
426
427 if no_ioloop:
~\anaconda3\lib\site-packages\tornado\web.py in listen(self, port, address, **kwargs)
2114 """
2115 server = HTTPServer(self, **kwargs)
-> 2116 server.listen(port, address)
2117 return server
2118
~\anaconda3\lib\site-packages\tornado\tcpserver.py in listen(self, port, address)
149 the `.IOLoop`.
150 """
--> 151 sockets = bind_sockets(port, address=address)
152 self.add_sockets(sockets)
153
~\anaconda3\lib\site-packages\tornado\netutil.py in bind_sockets(port, address, family, backlog, flags, reuse_port)
172
173 sock.setblocking(False)
--> 174 sock.bind(sockaddr)
175 bound_port = sock.getsockname()[1]
176 sock.listen(backlog)
OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
This is the code I'm trying to run:
viewer = imexam.connect(viewer='ginga')
viewer.load_fits('example_data/PAL5_3p6um.fits')
I've verified that both imexam and ginga are up to date, and I've tried the common problem fixes listed in the documentation, but no dice. Another user also on Windows 10 posted a similar-looking issue a couple of years ago (#151); could this be a Windows 10 specific issue? Thanks!
Apologies, I hadn't seen the 'port' option in connect() as given in the readme, which fixed my issue in the end. I don't think this is mentioned anywhere on the readthedocs though, maybe it could be useful to mention it on there too?
no worries -the best bug report is the one someone figures out the solution to themselves! I'm glad it's working for you. I'll definitely look through the docs and make sure things like this are easy to find -the docs are in need of another overhaul anyways.
many thanks!