diff options
Diffstat (limited to 'demos/demo_sftp.py')
-rwxr-xr-x | demos/demo_sftp.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/demos/demo_sftp.py b/demos/demo_sftp.py index 1cccffc2..9476f76c 100755 --- a/demos/demo_sftp.py +++ b/demos/demo_sftp.py @@ -96,7 +96,8 @@ try: sftp.mkdir("demo_sftp_folder") except IOError: print('(assuming demo_sftp_folder/ already exists)') - sftp.open('demo_sftp_folder/README', 'w').write('This was created by demo_sftp.py.\n') + with sftp.open('demo_sftp_folder/README', 'w') as f: + f.write('This was created by demo_sftp.py.\n') with open('demo_sftp.py', 'r') as f: data = f.read() sftp.open('demo_sftp_folder/demo_sftp.py', 'w').write(data) |