cascadium / wsl-windows-toolbar-launcher

Adds linux GUI application menu to a windows toolbar
MIT License
1.21k stars 50 forks source link

Some windows executables missing makes failures not graceful #12

Closed ringtailedfox closed 3 years ago

ringtailedfox commented 4 years ago

The script installs just fine, but if i try to run it with Python 3.8.3 x64 for Windows, I get this odd error:

C:>wsl-windows-toolbar Traceback (most recent call last): File "C:\Python38-x64\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Python38-x64\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Python38-x64\Scripts\wsl-windows-toolbar.exe__main.py", line 4, in File "C:\Python38-x64\lib\site-packages\wsl_windows_toolbar\wsl_windows_toolbar.py", line 8, in import magic File "C:\Python38-x64\lib\site-packages\magic.py", line 179, in libmagic = ctypes.CDLL(dll) File "C:\Python38-x64\lib\ctypes\init.py", line 373, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

fquinner commented 4 years ago

Hi there! The script needs to run within the wsl environment itself rather than on windows. I'll try and and add something to script to avoid what you did and make it a little more intuitive.

ringtailedfox commented 4 years ago

Hi there! The script needs to run within the wsl environment itself rather than on windows. I'll try and and add something to script to avoid what you did and make it a little more intuitive.

ahhh, okay that makes a lot more sense! I figured either I did something wrong, or was misunderstanding something... okay. thanks for the rapid response! :D

fcjbispo commented 4 years ago

Hi there! The script needs to run within the wsl environment itself rather than on windows. I'll try and and add something to script to avoid what you did and make it a little more intuitive.

This is what happens if it is called insid wsl: fcjbispo@RAGNAROK:/mnt/c/Users/fcjbispo$ wsl-windows-toolbar Traceback (most recent call last): File "/home/fcjbispo/.local/bin/wsl-windows-toolbar", line 5, in <module> from wsl_windows_toolbar.wsl_windows_toolbar import cli File "/home/fcjbispo/.local/lib/python3.8/site-packages/wsl_windows_toolbar/wsl_windows_toolbar.py", line 26, in <module> WINDOWS_USERPROFILE = subprocess.check_output( File "/usr/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 489, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.8/subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'cmd.exe' What do you mean with: "The script needs to run within the wsl environment itself rather than on windows." ?

fquinner commented 4 years ago

You'll need cmd.exe to be in your PATH too even when executing from within WSL :)

I mean it needs to be run within WSL bash. The originally reported issue was run from a windows shell.

matthieudesprez commented 4 years ago
export PATH=$PATH:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0

In my case that did the trick, because the script also needs powershell.exe

fquinner commented 3 years ago

These are now checked on startup and will fail gracefully of not present in 0.6.0