If a file without an extension contains an execute bit, opening the file with the default text editor fails with traceback (see below). Here, I am attempting to open the file "foo" (octal 744) by providing the path and pressing enter:
Traceback (most recent call last): File "/usr/bin/dmenu_extended_run", line 7, in <module> dmenu_extended.run(*sys.argv) File "/usr/lib/python3.10/site-packages/dmenu_extended/main.py", line 2015, in run handle_command(d, out) File "/usr/lib/python3.10/site-packages/dmenu_extended/main.py", line 1593, in handle_command d.execute(out) File "/usr/lib/python3.10/site-packages/dmenu_extended/main.py", line 717, in execute return subprocess.call(command) File "/usr/lib/python3.10/subprocess.py", line 345, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.10/subprocess.py", line 969, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/home/theo/foo'
If, however, the execute bit is removed (chmod 644), the file opens as expected in the default text editor (in my case terminal vim).
Note that if the file has an extension, e.g. foo.txt, it will open correctly, even if executable.
Reviewing the traceback, it would seem that if the file is executable and lacks an extension, dmenu_extended_run attempts to open it without using xdg-open. If the file has an extension and/or is not executable, it attempts to open it using xdg-open and thus succeeds.
If a file without an extension contains an execute bit, opening the file with the default text editor fails with traceback (see below). Here, I am attempting to open the file "foo" (octal 744) by providing the path and pressing enter:
Traceback (most recent call last): File "/usr/bin/dmenu_extended_run", line 7, in <module> dmenu_extended.run(*sys.argv) File "/usr/lib/python3.10/site-packages/dmenu_extended/main.py", line 2015, in run handle_command(d, out) File "/usr/lib/python3.10/site-packages/dmenu_extended/main.py", line 1593, in handle_command d.execute(out) File "/usr/lib/python3.10/site-packages/dmenu_extended/main.py", line 717, in execute return subprocess.call(command) File "/usr/lib/python3.10/subprocess.py", line 345, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.10/subprocess.py", line 969, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/home/theo/foo'
If, however, the execute bit is removed (chmod 644), the file opens as expected in the default text editor (in my case terminal vim).
Note that if the file has an extension, e.g. foo.txt, it will open correctly, even if executable.
Reviewing the traceback, it would seem that if the file is executable and lacks an extension, dmenu_extended_run attempts to open it without using xdg-open. If the file has an extension and/or is not executable, it attempts to open it using xdg-open and thus succeeds.