Author steven.daprano
Recipients ke265379ke, steven.daprano
Date 2020-12-25.13:05:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608901518.99.0.0678739799513.issue42733@roundup.psfhosted.org>
In-reply-to
Content
You say:

>  after process python3 test_case.py
>  json file's content like this
>  
>  @@@@@@@@@@{"how_dare_you": "how_dare_you"}


I cannot replicate that result.


I created a "data.json" with the following content:


```
>>> with open(FILE_PATH, 'w') as f:
...     f.write('{"how_dare_you": "how_dare_you"}\n')
... 
33
>>> with open(FILE_PATH, 'r') as f:
...     print(f.read())
... 
{"how_dare_you": "how_dare_you"}

```


Then I ran your `test` function and the only result was to delete the newline at the end of the file:


```
>>> test()
beginning tell 0
tell after read 33
tell after delete content 33
content 0 
tell after write 65
content 0 
>>> 
>>> with open(FILE_PATH, 'r') as f:
...     print(f.read())
... 
{"how_dare_you": "how_dare_you"}
>>> 
```

So I cannot replicate your reported bug. There is no sign of any garbage characters inserted at the start of the file as you state.
History
Date User Action Args
2020-12-25 13:05:19steven.dapranosetrecipients: + steven.daprano, ke265379ke
2020-12-25 13:05:18steven.dapranosetmessageid: <1608901518.99.0.0678739799513.issue42733@roundup.psfhosted.org>
2020-12-25 13:05:18steven.dapranolinkissue42733 messages
2020-12-25 13:05:18steven.dapranocreate