mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-11 00:58:31 +02:00
util fixes
This commit is contained in:
parent
bd6edffc81
commit
c8e5d1ff34
1 changed files with 5 additions and 2 deletions
|
@ -71,15 +71,18 @@ def py2encode(s):
|
|||
|
||||
def prompt(msg):
|
||||
"""Prints a message to the std err stream defined in util."""
|
||||
if not msg:
|
||||
return
|
||||
if not msg.endswith("\n"):
|
||||
msg += "\n"
|
||||
STDERR.write(u(msg))
|
||||
|
||||
def py23_input(msg=""):
|
||||
STDERR.write(u(msg))
|
||||
prompt(msg)
|
||||
return STDIN.readline().strip()
|
||||
|
||||
def py23_read(msg=""):
|
||||
prompt(msg)
|
||||
return STDIN.read()
|
||||
|
||||
def yesno(prompt, default=True):
|
||||
|
@ -93,7 +96,7 @@ def load_and_fix_json(json_path):
|
|||
"""
|
||||
with open(json_path) as f:
|
||||
json_str = f.read()
|
||||
config = fixed = None
|
||||
config = None
|
||||
try:
|
||||
return json.loads(json_str)
|
||||
except ValueError as e:
|
||||
|
|
Loading…
Add table
Reference in a new issue