[qutebrowser] How to run a userscript in Windows

David Nebauer davidnebauer3 at bigpond.com
Sun Sep 11 05:20:00 CEST 2016


>
>>      command called: spawn ['--userscript', 'hello.bat']
>> [...]
>>      Userscript to run:
>> C:\Users\ME\AppData\Local\qutebrowser\data\userscripts\hello.bat
> I'm guessing the hello.bat is in that location?

Well, no, as it turns out. The bat file was in:

	C:\Users\ME\AppData\Local\qutebrowser\userscripts\hello.bat


That is, not in the 'qutebrowser\data\userscripts' subdirectory but in 
'qutebrowser\userscripts' (note missing 'data' subdirectory).

Once I moved the bat file into the correct directory, qutebrowser was 
able to run it. The script then produced the qutebrowser log messages:

Userscript exited with status 1
     [...]
Process stdout:
     C:\Windows\system32>Echo ":message-info Test" 
1>>"C:\Users\ME\AppData\Local\Temp\tmp_y_rdd1a"
     Process stderr:
     The process cannot access the file because it is being used by 
another process.

I presume this is the "readonly FIFO" problem Kingdread documents in 
pull request #1927 <https://github.com/The-Compiler/qutebrowser/pull/1927>.

Note: I was able to run my python script from a userscript batch file 
containing a command like:

START /I "Run userscript" py C:\Users\ME\PATH\TO\PYTHON\SCRIPT.py %*

The python script successfully accessed and used QUTE_URL and other 
qutebrowser environmental variables. The python script was supposed to 
send feedback to qutebrowser using QUTE_FIFO but did not, presumably due 
to the FIFO bug. But it was otherwise a success.

So, my userscripts are running on windows now, and once the FIFO bug fix 
is incorporated into a windows release I'll be able to display script 
feedback in qutebrowser.

Sorry for wasting your time and Daniel's time. Still, it did point the 
way to the FIFO bug...

One thing would have helped me and you might consider implementing it: 
I'd have quickly known the cause of the problem if qutebrowser checked 
for the existence of a userscript before attempting to execute it and, 
in the event it is not found, gave a specific "userscript not found in 
<userscript directory path goes here>" message. I'll add a feature 
request for this.

Thanks for your help and for a great browser.



More information about the qutebrowser mailing list