git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@269 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2008/11/25 15:29:39... | ... |
@@ -267,8 +267,9 @@ def cmd_object_get(args): |
267 | 267 |
else: |
268 | 268 |
## File |
269 | 269 |
try: |
270 |
+ file_exists = os.path.exists(destination) |
|
270 | 271 |
dst_stream = open(destination, "ab") |
271 |
- if os.path.exists(destination): |
|
272 |
+ if file_exists: |
|
272 | 273 |
if Config().get_continue: |
273 | 274 |
start_position = dst_stream.tell() |
274 | 275 |
elif Config().force: |
... | ... |
@@ -276,6 +277,7 @@ def cmd_object_get(args): |
276 | 276 |
dst_stream.seek(0L) |
277 | 277 |
dst_stream.truncate() |
278 | 278 |
else: |
279 |
+ dst_stream.close() |
|
279 | 280 |
raise ParameterError("File %s already exists. Use either --force or --continue or give it a new name." % destination) |
280 | 281 |
except IOError, e: |
281 | 282 |
error("Skipping %s: %s" % (destination, e.strerror)) |