ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 02 Nov 2018 12:53:53 -0500How to attach a simple Sage script in a Sage Jupyter notebookhttp://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/**My two PCs' configurations:** Windows 8.1, Windows 10
**Sage version:** SageMath 8.3, windows installer 0.4
github.com/sagemath/sage-windows/releases
I want to use a Sage script in a Sage Jupyter Notebook (Jupyter with Sage as a kernel).
I have tried the following procedure:
1. I put a Sage code (definition of a function) in text file named Script.sage.
2. In a Jupyter notebook I tried command attach('Script.Sage')
3. I got a usage error:
UsageError: Invalid GUI request 'sage', valid ones are:[None, 'widget', 'qt5', 'qt', 'nbagg', 'osx', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk', 'ipympl', 'inline', 'asyncio', 'wx']
Some advice about where is a problem? What to do?
Or is there another procedure how to use a Sage code written in separate files in a Jupyter notebook?
Tue, 16 Oct 2018 07:31:13 -0500http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/Comment by Iguananaut for <p><strong>My two PCs' configurations:</strong> Windows 8.1, Windows 10 <br>
<strong>Sage version:</strong> SageMath 8.3, windows installer 0.4 <br>
github.com/sagemath/sage-windows/releases</p>
<p>I want to use a Sage script in a Sage Jupyter Notebook (Jupyter with Sage as a kernel).</p>
<p>I have tried the following procedure:</p>
<ol>
<li>I put a Sage code (definition of a function) in text file named Script.sage.</li>
<li>In a Jupyter notebook I tried command attach('Script.Sage')</li>
<li>I got a usage error:
UsageError: Invalid GUI request 'sage', valid ones are:[None, 'widget', 'qt5', 'qt', 'nbagg', 'osx', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk', 'ipympl', 'inline', 'asyncio', 'wx']</li>
</ol>
<p>Some advice about where is a problem? What to do?
Or is there another procedure how to use a Sage code written in separate files in a Jupyter notebook?</p>
http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/?comment=44167#post-id-44167The issue you're getting with `attach()` looks like a bit of a bug though. I don't think it's particular to Windows either. Even if it is "expected" from a coding perspective it is certainly unexected and unhelpful from a user perspective.Fri, 02 Nov 2018 12:53:53 -0500http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/?comment=44167#post-id-44167Answer by tmonteil for <p><strong>My two PCs' configurations:</strong> Windows 8.1, Windows 10 <br>
<strong>Sage version:</strong> SageMath 8.3, windows installer 0.4 <br>
github.com/sagemath/sage-windows/releases</p>
<p>I want to use a Sage script in a Sage Jupyter Notebook (Jupyter with Sage as a kernel).</p>
<p>I have tried the following procedure:</p>
<ol>
<li>I put a Sage code (definition of a function) in text file named Script.sage.</li>
<li>In a Jupyter notebook I tried command attach('Script.Sage')</li>
<li>I got a usage error:
UsageError: Invalid GUI request 'sage', valid ones are:[None, 'widget', 'qt5', 'qt', 'nbagg', 'osx', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk', 'ipympl', 'inline', 'asyncio', 'wx']</li>
</ol>
<p>Some advice about where is a problem? What to do?
Or is there another procedure how to use a Sage code written in separate files in a Jupyter notebook?</p>
http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/?answer=43967#post-id-43967I am not running windows, so i can not test, but the following works on GNU/Linux:
load('/path/to/script.sage')
It is not attached, meaning that when you modify the file, you will have to reload it manually to take changes into account.
Tue, 16 Oct 2018 11:10:59 -0500http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/?answer=43967#post-id-43967Comment by Jozef for <p>I am not running windows, so i can not test, but the following works on GNU/Linux:</p>
<pre><code>load('/path/to/script.sage')
</code></pre>
<p>It is not attached, meaning that when you modify the file, you will have to reload it manually to take changes into account.</p>
http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/?comment=43978#post-id-43978Thank you. The command `load` works in Windows as you described for Linux. It is sufficient for my purposes.Thu, 18 Oct 2018 09:26:56 -0500http://ask.sagemath.org/question/43964/how-to-attach-a-simple-sage-script-in-a-sage-jupyter-notebook/?comment=43978#post-id-43978