New submission from Chris Wesseling <chris.wessel...@xs4all.nl>:

json.tool is very cute and handy for making json readable.

But rewriting a file in place requires tools like sponge (on POSIX) or a 
tmpfile, because 

$ python -m json.tool foo.json foo.json

results in an empty foo.json.

I propose soaking up the infile before opening the outfile for writing, to 
prevent that. Much like sort -o does, but without the explicit flag.
The patch I have prepared changes no behaviours, other than preventing an empty 
file... (still I see this as an enhancement and not a bug fix)

----------
messages: 405182
nosy: CharString
priority: normal
severity: normal
status: open
title: Make json.tool soak up input before opening output for writing
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45644>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to