summaryrefslogtreecommitdiffhomepage
path: root/demos/demo_sftp.py
diff options
context:
space:
mode:
Diffstat (limited to 'demos/demo_sftp.py')
-rwxr-xr-xdemos/demo_sftp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/demos/demo_sftp.py b/demos/demo_sftp.py
index 9476f76c..c04d6e15 100755
--- a/demos/demo_sftp.py
+++ b/demos/demo_sftp.py
@@ -104,7 +104,8 @@ try:
print('created demo_sftp_folder/ on the server')
# copy the README back here
- data = sftp.open('demo_sftp_folder/README', 'r').read()
+ with sftp.open('demo_sftp_folder/README', 'r') as f:
+ data = f.read()
with open('README_demo_sftp', 'w') as f:
f.write(data)
print('copied README back here')