Mercurial > hg > orthanc
diff Resources/Samples/Python/DownloadAnonymized.py @ 2070:7e6afa0beaf6
samples: improved handling of special characters in paths
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 14 Jul 2016 09:05:22 +0200 |
parents | 65b1ce7cb84f |
children | a3a65de1840f |
line wrap: on
line diff
--- a/Resources/Samples/Python/DownloadAnonymized.py Wed Jul 13 16:52:39 2016 +0200 +++ b/Resources/Samples/Python/DownloadAnonymized.py Thu Jul 14 09:05:22 2016 +0200 @@ -44,6 +44,5 @@ # Trigger the download print('Downloading %s' % name) zipContent = RestToolbox.DoGet('%s/patients/%s/archive' % (URL, patient)) - f = open(os.path.join('/tmp', name + '.zip'), 'wb') - f.write(zipContent) - f.close() + with open(os.path.join('/tmp', name + '.zip'), 'wb') as f: + f.write(zipContent)