First time here? Check out the FAQ!

Sorry, this content is no longer available

Ask Your Question
2

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

asked 6 years ago

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?

Preview: (hide)

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 ( 6 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 6 years ago

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.

Preview: (hide)
link

Comments

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

Jozef gravatar imageJozef ( 6 years ago )

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

dantetante gravatar imagedantetante ( 2 years ago )

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: 6 years ago

Seen: 940 times

Last updated: Oct 16 '18