Ask Your Question

tcoffee's profile - activity

2012-08-11 02:01:03 +0200 commented question Sage is not updating modules imported by an attached file

Update: looks to me like the reloading behavior is handled by IPython: modified files are identified by `sage.misc.preparser.modified_attached_files`, which is only used by `sage.misc.interpreter`, where it calls the IPython API. In more recent versions of IPython than what I'm using, it looks like you can achieve the same behavior as the above workaround (subject to the same limitation) from within IPython using %autoreload: http://ipython.org/ipython-doc/stable/config/extensions/autoreload.html

2012-08-11 01:06:32 +0200 commented question Sage is not updating modules imported by an attached file

Update: actually, even this workaround is incomplete, because any function definitions I remove in the imported module still remain in Sage, which could lead to hidden bugs.

2012-08-11 00:30:33 +0200 commented question Sage is not updating modules imported by an attached file

I was just about to post the same question. It seems as though Sage internally stores a version of modules imported by attached files, which are never updated no matter what happens, though I was not able to figure out where it stores them. However, I've found that if you explicitly reload the module in the attached file, things seem to work: in your example, ... import bounds ... would be replaced with ... import bounds reload(bounds) ... You also need to re-save the attached file so that Sage will reload it.

2012-08-11 00:28:04 +0200 received badge  Editor (source)
2012-08-11 00:25:41 +0200 received badge  Supporter (source)
2012-08-11 00:25:27 +0200 answered a question Sage is not updating modules imported by an attached file

I was just about to post the same question. It seems as though Sage internally stores a version of modules imported by attached files, which are never updated no matter what happens, though I was not able to figure out where it stores them.

However, I've found that if you explicitly reload the module in the attached file, things seem to work: in your example,

...

import bounds

...

would be replaced with

...

import bounds

reload(bounds)

...

Does that work?

UPDATE: you also need to re-save the attached file so that Sage will reload it