hykilpikonna / hyfetch

🏳️‍🌈 🏳️‍⚧️ Neofetch with LGBTQ+ pride flags!
MIT License
1.15k stars 90 forks source link

Hyfetch fails to run on Termux due to missing '/usr/bin/env' #286

Closed icewithcola closed 1 month ago

icewithcola commented 1 month ago

Describe the bug

hyfetch cannot run on termux.

Expected behavior

hyfetch should run normally on termux

Screenshots

Error: [Errno 2] No such file or directory: '/usr/bin/env'
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/main.py", line 424, in run
    asc = get_distro_ascii() if not args.ascii_file else Path(args.ascii_file).read_text("utf-8")
          ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/neofetch_util.py", line 317, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/neofetch_util.py", line 338, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/neofetch_util.py", line 298, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 1951, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/env'

Environment

Termux 0.118.0 Android 14 Python 3.11.8

Additional context

I made a simple fix and fixed my problem but haven't tested on other platforms.

hykilpikonna commented 1 month ago

Hmm didn't realize that termux doesn't have /usr/bin/env... Maybe a better way to fix this is testing if /usr/bin/env exists, use which bash if it doesn't exist

hykilpikonna commented 1 month ago

I think I fixed it. Please test it and lmk if it works or doesn't work

icewithcola commented 1 month ago

I think I fixed it. Please test it and lmk if it works or doesn't work

It works now! Thanks for your fix.