[qutebrowser] How to run a userscript in Windows

Daniel Schadt daniel at kingdread.de
Wed Aug 31 23:36:02 CEST 2016


On 08/31/2016 11:08 PM, Florian Bruhin wrote:
> I'm guessing even from cmd.exe you couldn't simply run a .py file,
> right?

Actually... You can! To quote the "man page" ("help page"?)[1]:

> You can run nonexecutable files through their file association by
> typing the name of the file as a command.

Typing the path to a non-executable (or by using "start") will use the
set association. What I tried was using `subprocess`, which
does not do this - and I guess the underlying C calls (`CreateProcess`
iirc) show the same behaviour (but I haven't tested this yet). And it
gave the same error for .py files as it did for .txt files, which is
"not a valid Win32 application".

> Crazy idea, let's ship a general-purpose python.exe (if cx_Freeze
> doesn't do that already) and interpret shebangs on Windows in
> qutebrowser (no, please don't) :D

Sounds good, we could probably use `ast` to parse the source, and build
our own interpreter (QutePy? PyPy v2?)... Stop giving me stupid ideas :P

Daniel

[1]: https://technet.microsoft.com/en-us/library/cc770297(v=ws.11).aspx


More information about the qutebrowser mailing list