# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1368864647 -7200
# Node ID b9c56af6ae6889b207c8e90656b8df2874ba7dda
# Parent 1dc9f8e6974aac70f42cdb909141b7afddac7faf
Catch OSErrors when removing GAP workspaces
diff --git a/sage/interfaces/gap.py b/sage/interfaces/gap.py
a
|
b
|
|
1480 | 1480 | now = time.time() |
1481 | 1481 | for F in os.listdir(GAP_DIR): |
1482 | 1482 | if F.startswith('workspace-'): |
1483 | | age = now - os.path.getatime(os.path.join(GAP_DIR, F)) |
1484 | | if age >= 604800: # 1 week in seconds |
1485 | | os.unlink(os.path.join(GAP_DIR, F)) |
| 1483 | W = os.path.join(GAP_DIR, F) |
| 1484 | try: |
| 1485 | age = now - os.path.getatime(W) |
| 1486 | if age >= 604800: # 1 week in seconds |
| 1487 | os.unlink(W) |
| 1488 | except OSError: |
| 1489 | # It's not a problem if W doesn't exist, everything |
| 1490 | # else is an error. |
| 1491 | if os.path.exists(W): |
| 1492 | raise |
1486 | 1493 | |
1487 | 1494 | # Create new workspace with filename WORKSPACE |
1488 | 1495 | g = Gap(use_workspace_cache=False, max_workspace_size=None) |