Ask Your Question
1

can I use @interact also with the command line?

asked 2022-01-23 11:02:34 +0100

dantetante gravatar image

updated 2022-01-23 11:07:56 +0100

I understand that @interact is to be used inside of Jupyter. But since I like the command line much more, I'd like to know if there are ways to use it from a) the SageMath Console in Windows and b) Terminal on Mac OS X also.

edit retag flag offensive close merge delete

Comments

Not sure whether nbterm could help with that, but maybe worth a look.

slelievre gravatar imageslelievre ( 2022-01-23 12:52:39 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-01-23 14:12:43 +0100

Emmanuel Charpentier gravatar image

Short (unusable) answer : no.

Better answer : @interact wraps your function in an interact call ; interact ... interacts (surprise !) with an underlying notebook infrastructure running your interface when this infrastructure exists !. If you are running from the command line, this infrastructure does not exists, and interact has nothing to interact with.

In fact, typing interact? in a notebook cell gets you the documentation of the Interact class,which is the infrastructure needed for such interactions. But in a command line session :

sage: interact?
Object `interact` not found.

the interact function isn't even defined then.

Without looking at the source code, one can guess that the Interact class and its companions are defined at session startup ... if and only if the needed infrastructure exists in the session.

HTH,

edit flag offensive delete link more

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: 2022-01-23 11:02:34 +0100

Seen: 271 times

Last updated: Jan 23 '22