Commit aef7e95b05dc37295b7d239ed27e9fa22f76cab6
1 parent
198def5c
Exists in
master
and in
6 other branches
FIX: Remove a temporary file already removed raises a OSError in Linux, like rel…
…ated in #104. Encapsulate between a try ... except
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
invesalius/data/surface.py
@@ -266,6 +266,12 @@ class SurfaceManager(): | @@ -266,6 +266,12 @@ class SurfaceManager(): | ||
266 | os.remove(filename_polydata) | 266 | os.remove(filename_polydata) |
267 | except (WindowsError): | 267 | except (WindowsError): |
268 | print "Error while removing surface temporary file" | 268 | print "Error while removing surface temporary file" |
269 | + if sys.platform == 'linux2': | ||
270 | + try: | ||
271 | + os.remove(filename_img) | ||
272 | + os.remove(filename_polydata) | ||
273 | + except (OSError): | ||
274 | + print "Error while removing surface temporary file" | ||
269 | else: | 275 | else: |
270 | os.remove(filename_img) | 276 | os.remove(filename_img) |
271 | os.remove(filename_polydata) | 277 | os.remove(filename_polydata) |