Ask Your Question

notabot's profile - activity

2017-01-24 12:05:29 +0200 answered a question %attach/attach() does not work in sage jupyter (sage 7.5.1)

Since the answer is “Any workarounds?”, I'll document the one workaround that I found. However, the original problem persists; so I think that a bug report is due.

The workaround is to replace

%attach file.py

with

load("file.py")

Note that this workaround looses the automatic reloading feature; which is the point of attach in the first place. But at the very least, I can now load code and data from files.

2017-01-23 14:50:22 +0200 received badge  Student (source)
2017-01-23 14:50:09 +0200 commented question %attach/attach() does not work in sage jupyter (sage 7.5.1)

Upon further searching, I found that in file /Applications/SageMath-7.5.1.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/repl/inputhook.py there is a registered input hook: register('sage', sage_inputhook). It seems that the 'sage' GUI has no support for attaching files?

2017-01-23 14:50:09 +0200 asked a question %attach/attach() does not work in sage jupyter (sage 7.5.1)

Whenever I open a jupyter notebook in Sage 7.5.1 (sage -n jupyter), issuing a magic command

%attach myfile.py

or an inline attachcommand

attach("muyfile.py")

results in an error:

UsageError: Invalid GUI request 'sage', valid ones are:['osx', 'qt4', 'qt5', 'nbagg', None, 'gtk', 'gtk3', 'notebook', 'tk', 'inline', 'wx', 'qt']

I found this error in sagemath 7.5.1, but it is not present in sagemath 7.2. The magic %load, however, works.

Any workarounds? (besides changing %attach to %load, I mean.)