Skip to content

Commit e99ce8c

Browse files
committed
Fixed backup-and-restore example read and write files in binary mode.
1 parent 1fabca3 commit e99ce8c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

example/back-up-and-restore/backup-and-restore-example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# Uploads contents of LOCALFILE to Dropbox
2020
def backup():
21-
with open(LOCALFILE, 'r') as f:
21+
with open(LOCALFILE, 'rb') as f:
2222
# We use WriteMode=overwrite to make sure that the settings in the file
2323
# are changed on upload
2424
print("Uploading " + LOCALFILE + " to Dropbox as " + BACKUPPATH + "...")
@@ -41,7 +41,7 @@ def backup():
4141
# @param new_content is a string
4242
def change_local_file(new_content):
4343
print("Changing contents of " + LOCALFILE + " on local machine...")
44-
with open(LOCALFILE, 'w') as f:
44+
with open(LOCALFILE, 'wb') as f:
4545
f.write(new_content)
4646

4747
# Restore the local and Dropbox files to a certain revision

0 commit comments

Comments
 (0)