ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 22 Mar 2012 09:48:05 -0500Why can't I attach files?http://ask.sagemath.org/question/8815/why-cant-i-attach-files/Hi -
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](http://groups.google.com/group/sage-notebook/browse_thread/thread/f0004f475fb26b23) 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 load
execfile(preparse_file_named(fpath), globals)
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/interpreter.py", line 385, in preparse_file_named
preparse_file_named_to_stream(name, out)
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/interpreter.py", line 368, in preparse_file_named_to_stream
parsed = preparse_file(contents)
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/preparser.py", line 1240, in preparse_file
numeric_literals=not numeric_literals))
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/preparser.py", line 1126, in preparse
L)
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python/re.py", line 151, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python/re.py", line 273, in _subx
template = _compile_repl(template, pattern)
File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python/re.py", line 253, in _compile_repl
p = _cache_repl.get(key)
RuntimeError: maximum recursion depth exceeded in cmp
Installation details:
I'm using OSX Lion 10.7.3, and I installed the app version of Sage 4.8 (Sage-4.8-OSX-64bit-10.6.app). (Yes, I know I'm using the 10.6 version on a computer running 10.7, but as far as I could figure out, that's the best solution that works right now.) Thanks to some of the helpful posts and responses here on ASKSAGE about installing Sage on Lion, after some initial bumps, it seems to be running well, with this one exception.jdcThu, 22 Mar 2012 09:48:05 -0500http://ask.sagemath.org/question/8815/