Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

A Problem With Aliases #122

Open
erasmos-hmrc opened this issue Jul 7, 2022 · 1 comment
Open

A Problem With Aliases #122

erasmos-hmrc opened this issue Jul 7, 2022 · 1 comment

Comments

@erasmos-hmrc
Copy link

I installed the recommended version of Python (3.8).

On my system (MacOS), the binary was python3. However, I aliased it (via .zshrc) to python.

However, whenever I ran an sm command, I would get something like the following:

Traceback (most recent call last):
  File "/Users/seanrasmussen/.local/bin/sm", line 182, in <module>
    _process_command()
  File "/Users/seanrasmussen/.local/bin/sm", line 76, in _process_command
    for status_line in dostatus(context, args.shownotrunning):
  File "/Users/seanrasmussen/.local/pipx/venvs/servicemanager/lib/python3.8/site-packages/servicemanager/smstatus.py", line 65, in dostatus
    for service in context.services():
  File "/Users/seanrasmussen/.local/pipx/venvs/servicemanager/lib/python3.8/site-packages/servicemanager/smcontext.py", line 241, in <genexpr>
    return (self.get_service(service_name) for service_name in self.application.services)
  File "/Users/seanrasmussen/.local/pipx/venvs/servicemanager/lib/python3.8/site-packages/servicemanager/smcontext.py", line 253, in get_service
    return SmPythonService(self, service_name)
  File "/Users/seanrasmussen/.local/pipx/venvs/servicemanager/lib/python3.8/site-packages/servicemanager/service/smpythonservice.py", line 192, in __init__
    self.pattern = SmPythonService.get_pattern(self)
  File "/Users/seanrasmussen/.local/pipx/venvs/servicemanager/lib/python3.8/site-packages/servicemanager/service/smpythonservice.py", line 249, in get_pattern
    if _is_python_3():
  File "/Users/seanrasmussen/.local/pipx/venvs/servicemanager/lib/python3.8/site-packages/servicemanager/service/smpythonservice.py", line 26, in _is_python_3
    proc = subprocess.Popen(["python", "--version"],
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python'

After various attempts, I found that changing this line to use the shell worked:

   proc = subprocess.Popen(["python", "--version"],
                          shell=True,


Note that I'm not using pyenv as recommended.

@erasmos-hmrc
Copy link
Author

Actually, I had to update the shell to be 'True' in all three places to make it work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant