Why can't I attach files?
I recently installed Sage on my new Macbook (although I've used Sage before, on my old -- and sadly, recently stolen -- Macbook). I'm using the Sage notebook. (Details of my installation below.)
If I attach a file ("attach foo.sage"), it loads/runs the commands in that file, just like it's supposed to and used to. However, if I make any alteration to the attached file while the Sage notebook is still running, then when I return to the notebook and try to do anything, Sage freaks out.
By "freak out," I mean that if I try to do any computation, even one that doesn't involve the variables or functions in the attached file (e.g., "2+2"), I get a massive error message, which ends with "RuntimeError: maximum recursion depth exceeded in cmp". I've pasted more of the error message below. This behavior continues until I quit and restart that notebook. It seems that the contents of the attached file are irrelevant -- I've tried it with simple files that contain nothing but a single print command, or something basic like "a=5".
I did a little searching, and I turned up this discussion on the sage-notebook Google Group, where William Stein notes this behavior. So obviously somebody who knows something is aware of this. But that was all I could find anywhere, and I have no sense for whether there is a fix/workaround for this.
I briefly tested to see if this also happens when I use Sage from a terminal. I don't get the recursion error then. However, if I re-enter the "attach" command after I've altered the attached file, it appears to run through the commands in that file twice. (So, for instance, if the attached file includes "print 'Hello!'", it will do this twice.) I understand that the command line avoids the error, but I would really prefer to use the notebook if I can.
Any ideas? Please speak slowly and use small words (metaphorically). Thanks!
The error message starts with...
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_14.py", line 10, in <module> File "", line 1, in <module> File "/private/var/folders/5h/c6x89ch91fjgr43q99g8wbjw0000gn/T/tmphXrluN/___code___.py", line 3, in <module> sage.misc.preparser.load(sage.misc.preparser.base64.b64decode("Ii9Vc2Vycy9Kb2huL0Rlc2t0b3AvU2FnZV9zY3JpcHRzL3Rlc3Rlci5zYWdlIg=="),globals(),True) File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/preparser.py", line 1644, in load execfile(preparse_file_named(fpath), globals) File "/Users/John/.sage/temp/C_K_Dexter_Haven.local/34442/_Users_John_Desktop_Sage_scripts_tester_sage_6.py", line 6, in <module>
Then, the latter 4 lines (starting with "sage.misc.preparser.load") are repeated 492 more times, with the only thing changing being the number following "scripts_tester_sage_" in the last line. Then, it ends with:
sage.misc.preparser.load(sage.misc.preparser.base64.b64decode("Ii9Vc2Vycy9Kb2huL0Rlc2t0b3AvU2FnZV9zY3JpcHRzL3Rlc3Rlci5zYWdlIg=="),globals(),True) File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/preparser.py", line 1644, in ...