Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

attach is broken #169

Closed
vbraun opened this issue Jun 18, 2013 · 9 comments
Closed

attach is broken #169

vbraun opened this issue Jun 18, 2013 · 9 comments
Labels

Comments

@vbraun
Copy link
Member

vbraun commented Jun 18, 2013

Automatic reloading of attached files is broken on Sage-5.10.rc2. For example, start with a file containing "x=1". Then, in the notebook:

attach('/tmp/t.py')
x

works as intended. Now change the file to "x=2". All subsequent evaluations yield

Traceback (most recent call last):
File "", line 1, in
File "sage_input_5.py", line 10, in
exec compile(u'open("code.py","w").write("# -
- coding: utf-8 --\n" + support.preparse_worksheet_cell(base64.b64decode("eA=="),globals())+"\n"); execfile(os.path.abspath("_code.py"))
File "", line 1, in

File "/tmp/tmpdG1Jqn/_code_.py", line 2
"/tmp/t.py"
^
IndentationError: unexpected indent

Ideally, this would be fixed in a way compatible with http://trac.sagemath.org/14523

@vbraun
Copy link
Member Author

vbraun commented Jun 26, 2013

This reportedly worked in some sage-5.x version

https://groups.google.com/d/msg/sage-devel/gHlK7zmgcAg/mREDSLLeI7wJ

@ppurka
Copy link
Member

ppurka commented Jun 26, 2013

I suspect it might have been earlier than 5.4. The flask notebook was
introduced in 5.4 and quite a few things regressed, even though it was
tested for months.

On Wed, Jun 26, 2013 at 12:07 PM, vbraun notifications@github.com wrote:

This reportedly worked in some sage-5.x version

https://groups.google.com/d/msg/sage-devel/gHlK7zmgcAg/mREDSLLeI7wJ


Reply to this email directly or view it on GitHubhttps://github.com//issues/169#issuecomment-20026120
.

@vbraun
Copy link
Member Author

vbraun commented Jun 26, 2013

Given the current state of the notebook we should just remove the attach functionality in the notebook. Can be re-added to the new notebook when it is out.

@jhpalmieri
Copy link
Member

So if we don't find a fix, should we make 'attach' just work like 'load', along with a warning that this is what it's doing?

Meanwhile, not only does it do automatic reloading, it just doesn't work: if I attach a file containing

print 3
b=4

then 3 gets printed, but if I evaluate b, I get a message saying that it is not defined. If I load the file instead, then b is defined.

@ppurka
Copy link
Member

ppurka commented Dec 18, 2013

I would prefer to just disable it, or maybe print an error message telling the user to use load instead.

@kcrisman
Copy link
Member

kcrisman commented Nov 6, 2014

Interestingly, I don't get any errors, just that it doesn't redo stuff when I change a file - whether from DATA or on the computer's filesystem. I am changing some doc related to this, anyway, which should help a tiny bit too - see 48bd7e7 .

@kcrisman kcrisman added Major and removed Critical labels Nov 6, 2014
@kcrisman
Copy link
Member

kcrisman commented Dec 3, 2014

I strongly suspect that this is related to lazy import, as pointed out in http://trac.sagemath.org/ticket/15308#comment:3 - at any rate, I'll be trying this out to see. Edit: or maybe not, still seems to be broken in earlier versions - I can't get it to work in 5.2, though the error is quite different, a recursion depth issue.

@kcrisman
Copy link
Member

kcrisman commented Dec 3, 2014

Interestingly, anything that requires preparsing seems to be bad now.

@kcrisman
Copy link
Member

kcrisman commented Dec 3, 2014

Using sage.misc.attached_files.attached_files() shows that attaching files does indeed happen; it is just not preparsed or something - indeed, .py files "work". However, I can confirm that things don't seem to stay defined.

@kcrisman kcrisman added Critical and removed Major labels Dec 3, 2014
@dimpase dimpase closed this as completed Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants