Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'No such file or directory' error occurs when running hyfetch on Windows #84

Closed
1 task done
Namorzyny opened this issue Jan 27, 2023 · 3 comments
Closed
1 task done
Labels

Comments

@Namorzyny
Copy link

Namorzyny commented Jan 27, 2023

Description

hyfetch is installed by pip. After I maked a workground for #83, it throws <path of python>/Lib/site-packages/neofetch: No such file or directory. I tried copy <path of python>/Scripts/neowofetch to <path of python>/Lib/site-packages/neofetch, the script runs successfully but freezed like #82.

$ hyfetch
/usr/bin/bash: line 1: /c/Users/zzz/scoop/apps/python/current/Lib/site-packages/neofetch: No such file or directory
Error: Command '[WindowsPath('C:/Program Files/Git/bin/bash.exe'), '-c', '/c/Users/zzz/scoop/apps/python/current/Lib/site-packages/neofetch ascii_distro_name']' returned non-zero exit status 127.
Traceback (most recent call last):
  File "C:\Users\zzz\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 429, in run
    neofetch_util.run(preset, config.color_align, config.backend)
  File "C:\Users\zzz\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 265, in run
    return run_neofetch(preset, alignment)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\zzz\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 279, in run_neofetch
    asc = get_distro_ascii()
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\zzz\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 239, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "C:\Users\zzz\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 260, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\zzz\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 220, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\zzz\scoop\apps\python\current\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\zzz\scoop\apps\python\current\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '[WindowsPath('C:/Program Files/Git/bin/bash.exe'), '-c', '/c/Users/zzz/scoop/apps/python/current/Lib/site-packages/neofetch ascii_distro_name']' returned non-zero exit status 127.
  • Does this issue still occur in the master branch? (Required if issue)

Neofetch version

7.3.6

Screenshot

See description above and #82.

@jules-party
Copy link

I managed to get it work, it doesn't freeze, just a bit slow.

All I did was make a symbolic link, just like this:

cmd /c mklink %userprofile%\scoop/apps/python/current/Lib/site-packages/neofetch %userprofile%\scoop\apps\python\current\Scripts\neowofetch

@hykilpikonna
Copy link
Owner

Oops. I hard-coded the path before when people reported that the symbolic link path doesn't work... maybe different python implementations/versions install scripts to different paths, and it seems that the site-packages/neofetch path is no longer valid... weird, it should be installed along with the source distribution 🤔

image

@hykilpikonna
Copy link
Owner

Ok so the cause is that in higher versions of setup.py packaging, the package script actually expands symlinks and doesn't keep the original symlink and item in their source locations. (i.e. ./hyfetch/scripts/neowofetch is a symlink to ./neofetch in the source repo, but in the packaged zip it is regular file instead). So I added another fix to check both of these paths plus the command name in PATH. Should work now.

image

image

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

No branches or pull requests

3 participants