On Monday, September 14, 2015 at 5:46:45 AM UTC-4, Sébastien Labbé wrote:
>
>
>
> On Monday, September 14, 2015 at 11:03:17 AM UTC+2, Volker Braun wrote:
>>
>> Did you try :set backupcopy=yes in vim?
>>
>
> Thank you! You save my life!
>

I also experience this problem sometimes, and especially when I'm using 
Dropbox like so: edit a file locally which is synced via Dropbox to a 
machine on which I run sage. This really triggers the problem.

Salvatore Stella (CCed) also had this problem and tried using this setting 
in vim. It seems to help, but it didn't solve the problem. It appears to 
depend on the latency of the network (i.e., this still happens if you are 
saving to a network drive).

To fix it, he patched his version of sage like so:

diff --git a/src/sage/repl/attach.py b/src/sage/repl/attach.py
index 9ebc3ef..00df8d4 100644
--- a/src/sage/repl/attach.py
+++ b/src/sage/repl/attach.py
@@ -514,9 +514,12 @@ def modified_file_iterator():
     for filename in attached.keys():
         old_tm = attached[filename]
         if not os.path.exists(filename):
-            print('### detaching file {0} because it does not exist 
(deleted?) ###'.format(filename))
-            detach(filename)
-            continue
+            # check again in a while to prevent race conditions on some 
editors
+            time.sleep(0.1)
+            if not os.path.exists(filename):
+                print('### detaching file {0} because it does not exist 
(deleted?) ###'.format(filename))
+                detach(filename)
+                continue
         new_tm = os.path.getmtime(filename)
         if new_tm > old_tm:
             modified[filename] = new_tm

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to