{"action":"created","issue":{"url":"https://api.github.com/repos/spacetelescope/imexam/issues/44","repository_url":"https://api.github.com/repos/spacetelescope/imexam","labels_url":"https://api.github.com/repos/spacetelescope/imexam/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/spacetelescope/imexam/issues/44/comments","events_url":"https://api.github.com/repos/spacetelescope/imexam/issues/44/events","html_url":"https://github.com/spacetelescope/imexam/issues/44","id":130859369,"number":44,"title":"connect without an argument raises an error","user":{"login":"eteq","id":346587,"avatar_url":"https://avatars.githubusercontent.com/u/346587?v=3","gravatar_id":"","url":"https://api.github.com/users/eteq","html_url":"https://github.com/eteq","followers_url":"https://api.github.com/users/eteq/followers","following_url":"https://api.github.com/users/eteq/following{/other_user}","gists_url":"https://api.github.com/users/eteq/gists{/gist_id}","starred_url":"https://api.github.com/users/eteq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eteq/subscriptions","organizations_url":"https://api.github.com/users/eteq/orgs","repos_url":"https://api.github.com/users/eteq/repos","events_url":"https://api.github.com/users/eteq/events{/privacy}","received_events_url":"https://api.github.com/users/eteq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-02T23:56:45Z","updated_at":"2016-02-03T17:17:30Z","closed_at":null,"body":"I noticed a strange error when I follow the instructions for Example 1 at http://imexam.readthedocs.org/imexam/examples.html .  If I try to connect to ds9 via ``imexam.connect()`` without explicitly saying ``imexam.connect('ds9')`` (which is what Example 1 suggests is possible), I get a rather arcane error that I don't really understand.  I do suspect it has something to do with the ``# this might be sketchy`` line right above, though ;)\r\n\r\n```\r\nIn [2]: import imexam\r\nIn [3]: viewer = imexam.connect()\r\n/Users/erik/miniconda3/envs/imexam/lib/python3.5/site-packages/imexam-0.5.3.dev0-py3.5-macosx-10.5-x86_64.egg/imexam/ds9_viewer.py:554: UserWarning: Starting ds9 failed\r\n  warnings.warn(\"Starting ds9 failed\")\r\n---------------------------------------------------------------------------\r\nUnboundLocalError                         Traceback (most recent call last)\r\n<ipython-input-3-6f0574bcd0ef> in <module>()\r\n----> 1 viewer = imexam.connect()\r\n\r\n/Users/erik/miniconda3/envs/imexam/lib/python3.5/site-packages/imexam-0.5.3.dev0-py3.5-macosx-10.5-x86_64.egg/imexam/connect.py in __init__(self, target, path, viewer, wait_time, quit_window)\r\n     80         if 'ds9' in self._viewer:\r\n     81             self.window = ds9(\r\n---> 82                 target=target, path=path, wait_time=wait_time, quit_ds9_on_del=quit_window)\r\n     83             self._event_driven_exam = False  # use the imexam loop\r\n     84 \r\n\r\n/Users/erik/miniconda3/envs/imexam/lib/python3.5/site-packages/imexam-0.5.3.dev0-py3.5-macosx-10.5-x86_64.egg/imexam/ds9_viewer.py in __init__(self, target, path, wait_time, quit_ds9_on_del)\r\n    198 \r\n    199             elif 'local' in self._xpa_method:\r\n--> 200                 self._xpa_name, self._ds9_unix_name = self._run_unixonly_ds9()\r\n    201 \r\n    202             # tells xpa where to find sockets\r\n\r\n/Users/erik/miniconda3/envs/imexam/lib/python3.5/site-packages/imexam-0.5.3.dev0-py3.5-macosx-10.5-x86_64.egg/imexam/ds9_viewer.py in _run_unixonly_ds9(self)\r\n    562         # this might be sketchy\r\n    563         try:\r\n--> 564             file_list.remove(\".IMT\")  # should be in the directory, if not\r\n    565         except (ValueError, IOError):\r\n    566             warnings.warn(\"IMT not found in tmp, using first thing in list\")\r\n\r\nUnboundLocalError: local variable 'file_list' referenced before assignment\r\n```"},"comment":{"url":"https://api.github.com/repos/spacetelescope/imexam/issues/comments/179355953","html_url":"https://github.com/spacetelescope/imexam/issues/44#issuecomment-179355953","issue_url":"https://api.github.com/repos/spacetelescope/imexam/issues/44","id":179355953,"user":{"login":"pllim","id":2090236,"avatar_url":"https://avatars.githubusercontent.com/u/2090236?v=3","gravatar_id":"","url":"https://api.github.com/users/pllim","html_url":"https://github.com/pllim","followers_url":"https://api.github.com/users/pllim/followers","following_url":"https://api.github.com/users/pllim/following{/other_user}","gists_url":"https://api.github.com/users/pllim/gists{/gist_id}","starred_url":"https://api.github.com/users/pllim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pllim/subscriptions","organizations_url":"https://api.github.com/users/pllim/orgs","repos_url":"https://api.github.com/users/pllim/repos","events_url":"https://api.github.com/users/pllim/events{/privacy}","received_events_url":"https://api.github.com/users/pllim/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T17:17:29Z","updated_at":"2016-02-03T17:17:29Z","body":"The difference between `connect()` (`target=None`) and `connect('ds9')` (`target='ds9'`) is this logic in `ds9_viewer.py`:\r\n\r\n```python\r\n        if not target:\r\n            # Check to see if the user has chosen a preference first\r\n            if 'XPA_METHOD' in os.environ:\r\n                self._xpa_method = os.environ['XPA_METHOD'].lower()\r\n\r\n            if 'inet' in self._xpa_method:\r\n                self._xpa_name = self.run_inet_ds9()\r\n                # xpa_name is the title of the window, the xpa can be referenced\r\n                # with either the socket address or name of the window\r\n\r\n            elif 'local' in self._xpa_method:\r\n                self._xpa_name, self._ds9_unix_name = self._run_unixonly_ds9()\r\n\r\n            # tells xpa where to find sockets\r\n            os.environ['XPA_METHOD'] = self._xpa_method\r\n\r\n        else:\r\n            # just register with the target the user provided\r\n            self._xpa_name = target\r\n```"}}