The attach (watch, reload, execute) function implementation in Sage must do 
something while sitting at the python input prompt, this is already 
somewhat at odds with GUI toolkits that want to run the main event loop. 
IPython has some support for the event loop integration, which is where the 
error message comes from. The last time I worked on it there was no 
notebook event loop integration, so attach could not work in the jupyter 
notebook. The error message seems to indicate that this changed, so maybe 
it is possible now. Still there are some UI questions, e.g. which cell 
would the attach() output be in...


On Wednesday, December 12, 2018 at 6:15:46 PM UTC+1, John Cremona wrote:
>
> I have a file testcong.py which contains various functions I am 
> developing, while testing them in a jupyter notebook.  The first cell in 
> the notebook has the "magic" line "%run testcong.py" and so whenever I make 
> a change to the .py file I have to re-click on that cell.  This gets 
> tedious, especially when the testing notebook has may cells in it since I 
> am forever scrolling up and down.
>
> There has to be a better way.  From the command line one can use attach 
> instead of runfile (which automatically rereads the file when it changes) 
> but I cannot get that to work, even though there is a magic %attach command:
>
> %attach testcong.py
>
> fails with a weird error message which is incomprehensible to me:
>
> "UsageError: Invalid GUI request 'sage', valid ones are:['osx', 'widget', 
> 'qt5', None, 'qt', 'nbagg', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk', 
> 'ipympl', 'inline', 'asyncio', 'wx']"
>
> while 
>
> %attach "testcong.py"
>
> (with quotes) is better, it just cannot find the file (which is in the 
> current directory, i.e. the one I started the notebook from).  But giving 
> the full pathname
>
> %attach "/home/jec/congruences/testcong.py"
>
> also gives "IOError: did not find file 
> '/home/jec/congruences/testcong.py"' to load or attach"
>
> What am I doing wrong?  I did try looking for documentation but failed...
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to