Ask Your Question
2

How to attach a simple Sage script in a Sage Jupyter notebook

asked 2018-10-16 14:31:13 +0100

Jozef gravatar image

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?

edit retag flag offensive close merge delete

Comments

The 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.

Iguananaut gravatar imageIguananaut ( 2018-11-02 18:53:53 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-10-16 18:10:59 +0100

tmonteil gravatar image

I 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.

edit flag offensive delete link more

Comments

Thank you. The command load works in Windows as you described for Linux. It is sufficient for my purposes.

Jozef gravatar imageJozef ( 2018-10-18 16:26:56 +0100 )edit

Can anyone explain why load works and attach doesn't?

dantetante gravatar imagedantetante ( 2022-04-05 19:49:49 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-10-16 14:31:13 +0100

Seen: 937 times

Last updated: Oct 16 '18