imexam icon indicating copy to clipboard operation
imexam copied to clipboard

cannot load when directory path has spaces

Open stscieisenhamer opened this issue 6 years ago • 2 comments

Issue

This is more of an XPA thing I believe, but if a directory path has a space, loading fails:

$ pwd
/Users/eisenham/Downloads/longname level_1/longname_level_2/longname_level_3/longname_level_4/langname_level_5
$ ipython
In [1]: import imexam

In [2]: viewer = imexam.connect()

In [3]: viewer.load_fits('ngc3344_crop.fits')
---------------------------------------------------------------------------
XpaException                              Traceback (most recent call last)
<ipython-input-3-560085a1472f> in <module>()
----> 1 viewer.load_fits('ngc3344_crop.fits')

~/anaconda3/envs/astro3d_astroconda/lib/python3.5/site-packages/imexam/connect.py in load_fits(self, *args, **kwargs)
    382         else:
    383             self.exam._datafile = args[0]
--> 384         self.window.load_fits(*args, **kwargs)
    385
    386     def load_region(self, *args, **kwargs):

~/anaconda3/envs/astro3d_astroconda/lib/python3.5/site-packages/imexam/ds9_viewer.py in load_fits(self, fname, extver, mecube)
   1186             cstring = ('fits {0:s}[{1:d}]'.format(shortname, extver))
   1187
-> 1188         self.set(cstring)
   1189         self._set_frameinfo()
   1190         # make sure any previous reference is reset

~/anaconda3/envs/astro3d_astroconda/lib/python3.5/site-packages/imexam/ds9_viewer.py in set(self, param, buf)
    681         """
    682         self._check_ds9_process()
--> 683         self.xpa.set(param, buf)
    684
    685     def get(self, param):

~/anaconda3/envs/astro3d_astroconda/lib/python3.5/site-packages/imexam/xpa_wrap.py in set(self, param, buf)
     17     def set(self, param="", buf=None):
     18         """send information to the xpa."""
---> 19         super(XPA, self).set(param.encode('utf-8', 'strict'), buf)

wrappers/xpa.pyx in xpa.xpa.set()

wrappers/xpa.pyx in xpa._set()

XpaException: b'XPA$ERROR Unable to load fits  /Users/eisenham/Downloads/longname (DS9:imexam1524243209.4894 a010aa0:58955)\n'

stscieisenhamer avatar Apr 20 '18 16:04 stscieisenhamer

yah, I have to give xpa the full path reference, but I believe I'm constructing that myself, so maybe an easy fix

sosey avatar Apr 20 '18 17:04 sosey

related: make sure spaces are stripped from the filename itself as well

sosey avatar Oct 28 '19 16:10 sosey