Ticket #10229: trac_10229.patch

File trac_10229.patch, 1.0 KB (added by mboratko, 10 years ago)

Suppress exception message for moved or deleted attachments

  • sage/misc/preparser.py

    # HG changeset patch
    # User Michael Boratko <boratko@gmail.com>
    # Date 1321513473 18000
    # Node ID 540f1f6a45d6ce46157ca726092ac6ac76e6a7f1
    # Parent  9e29a3d84c48c399daaf3920bcb8b17273a0e876
    trac 10229: suppress exception about missing attachments
    
    diff --git a/sage/misc/preparser.py b/sage/misc/preparser.py
    a b  
    17871787    # ones that we returned as loaded.
    17881788    for F in attached.keys():
    17891789        tm = attached[F]
    1790         new_tm = os.path.getmtime(F)
    1791         if os.path.exists(F) and new_tm > tm:
    1792             # F is newer than last time we loaded it.
    1793             attached[F] = os.path.getmtime(F)
    1794             yield F
     1790        try:
     1791                new_tm = os.path.getmtime(F)
     1792                if os.path.exists(F) and new_tm > tm:
     1793                    # F is newer than last time we loaded it.
     1794                    attached[F] = os.path.getmtime(F)
     1795                    yield F
     1796        except OSError, e:
     1797            if e.errno==2: # File no longer exists
     1798                pass
    17951799   
    17961800def attached_files():
    17971801    """