Dear sage-devel,

Here's a minimal version of something that happened to me a few times
recently:

{{{
17:57:03:~$ touch myfile.sage
17:57:05:~$ sage
----------------------------------------------------------------------
| Sage Version 5.8, Release Date: 2013-03-15                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
sage: %attach myfile.sage
sage: file('myfile.sage', 'w').write('1/0')
sage: 1+1
...
ZeroDivisionError: Rational division by zero
sage: exit
...
ZeroDivisionError: Rational division by zero
sage: detach('myfile.sage')
...
ZeroDivisionError: Rational division by zero
}}}

It seems like the only way to continue using this Sage session is to fix
the error first. But suppose you have some reason not to (e.g. are in a
hurry, and the error is hard to fix). I think it would be much better if
Sage was to evaluate "1+1" and especially "exit" and "detach" even when
unable to reload one of the attached files. Shall I open a ticket for this?

And how to fix this? I have three ideas that all have a downside:
* Catching the error will destroy a valuable traceback (which I removed
above). Or is there a way to preserve that traceback and have it printed
somehow?
* How about attempting to reload only once (move the line "attached[fpath]
= os.path.getmtime(fpath)" to just before "execfile" in
sage.misc.preparser.load)? This may hide the problem: there will be only
one error message when attach fails, which the user may mistake for an
error related to the last input, and then think the latest version of the
file is safely attached, while actually an old version is still being used.
* Is it possible to separate the reloading from the evaluation of the input
line? This may be the best option. Any idea how to implement that? Looks
like this is handled in IPython/core/interactiveshell.py , so it would mean
patching IPython?
* Any other ideas?

Marco

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to