nancym / ii-issues

0 stars 0 forks source link

ii.com: qutebrowser Tips and Fragments #19

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

ii.com: qutebrowser Tips and Fragments

http://www.ii.com/qutebrowser-tips-fragments/

PengjuXu commented 2 years ago

use exec(open('', 'r').read()), better than config.source('')

to use env-var, use Python string

But sometimes environment variables do not work. For example, I have been unable to figure out how to use an environment variable in either of the following config.py settings.

for example:

import os
_user_dir = "C:\\Users\\" + os.environ.get('USERNAME', 'default_value')
# need at least Python3.8 for string formatting:  f''
config.bind(',t', f'spawn -u "{_user_dir}\\Sync\\qb\\tumblelog-wrapper.cmd"')