ericmandel / pyds9

Python connection to SAOimage DS9 via XPA
76 stars 41 forks source link

I get a TypeError #104

Closed PrabhaniR closed 2 years ago

PrabhaniR commented 2 years ago

When I run pyds9.DS9() and it results the following error: TypeError: expected str, bytes or os.PathLike object, not NoneType

What am I doing wrong? I posted the error in detail below. Thanks in advance!

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [50], in <cell line: 1>()
----> 1 d = pyds9.DS9()

File ~/opt/anaconda3/lib/python3.9/site-packages/pyds9.py:439, in DS9.__init__(self, target, start, wait, verify)
    437     except TypeError:       # Not an iterable object
    438         args = []
--> 439 self.pid = subprocess.Popen(ds9Globals["progs"][1] +
    440                             ['-title', target] + args)
    442 for i in range(wait):
    443     tlist = xpa.xpaaccess(string_to_bytes(target), None, 1024)

File ~/opt/anaconda3/lib/python3.9/subprocess.py:951, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    947         if self.text_mode:
    948             self.stderr = io.TextIOWrapper(self.stderr,
    949                     encoding=encoding, errors=errors)
--> 951     self._execute_child(args, executable, preexec_fn, close_fds,
    952                         pass_fds, cwd, env,
    953                         startupinfo, creationflags, shell,
    954                         p2cread, p2cwrite,
    955                         c2pread, c2pwrite,
956                         errread, errwrite,
    957                         restore_signals,
    958                         gid, gids, uid, umask,
    959                         start_new_session)
    960 except:
    961     # Cleanup if the child failed starting.
    962     for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File ~/opt/anaconda3/lib/python3.9/subprocess.py:1696, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session)
   1691     executable = args[0]
   1693 sys.audit("subprocess.Popen", executable, args, cwd, env)
   1695 if (_USE_POSIX_SPAWN
-> 1696         and os.path.dirname(executable)
   1697         and preexec_fn is None
   1698         and not close_fds
   1699         and not pass_fds
   1700         and cwd is None
   1701         and (p2cread == -1 or p2cread > 2)
   1702         and (c2pwrite == -1 or c2pwrite > 2)
   1703         and (errwrite == -1 or errwrite > 2)
   1704         and not start_new_session
   1705         and gid is None
   1706         and gids is None
   1707         and uid is None
   1708         and umask < 0):
   1709     self._posix_spawn(args, executable, env, restore_signals,
   1710                       p2cread, p2cwrite,
   1711                       c2pread, c2pwrite,
   1712                       errread, errwrite)
   1713     return

File ~/opt/anaconda3/lib/python3.9/posixpath.py:152, in dirname(p)
    150 def dirname(p):
    151     """Returns the directory component of a pathname"""
--> 152     p = os.fspath(p)
    153     sep = _get_sep(p)
    154     i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType
ericmandel commented 2 years ago

The pyds9 project does not currently have a Python expert to help with maintenance. I can deal with XPA-related problems, but not Python problems such as this one. But in this particular case, I wonder if you might have installed pyds9 from somewhere other than the github repository? If so, you almost certainly installed an old version, incompatible with Python3. Try installing from the repository.

PrabhaniR commented 2 years ago

Thank you! I will try reinstalling PyDS9.