#20604 closed Bug (fixed)
Managing Files File code example opens file in write-mode, should open in read-mode
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
In the second code example in the Managing Files documentation on the File object, the file /tmp/hello.world is shown as being opened in write-mode, but it should actually be opened in read mode. Write-mode would destroy the contents of the file.
In other words, please change this
# Create a Python file object using open() and the with statement >>> with open('/tmp/hello.world', 'w') as f: >>> myfile = File(f) ...
to this
# Create a Python file object using open() and the with statement >>> with open('/tmp/hello.world') as f: >>> myfile = File(f) ...
Note:
See TracTickets
for help on using tickets.
In a1122e14a6d2ace8907923507e7d31c44a6f7c68: