Ask Your Question

Running sage on an input file via the command line

asked 2013-12-02 09:11:36 +0100

sjr gravatar image

I have a file abc.sage that contains the commands plot(x^2).show(). From the command line I run "sage abc.sage". The plot command is executed, the viewer appears, and I get a message that a certain png file is not present where expected. Any solutions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-12-02 09:35:24 +0100

tmonteil gravatar image

updated 2013-12-02 09:37:34 +0100

The reason is that the image is stored in a temporary subdirectory of your ~/.sage/temp directory, but this temporary directory is removed when the execution of your abc.sage script is finished (the name of the directory depends on the process that created it). So when your image viewer is launched, it cannot find it anymore. You can check this by adding the line:


at the end of your abc.sage script, and your image viewer will have the time to get the image before it disapears.

You can also launch Sage and in the Sage command line, and then type:

sage: %runfile abc.sage
edit flag offensive delete link more


Thanks! Problem solved.

sjr gravatar imagesjr ( 2013-12-02 09:48:41 +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


Asked: 2013-12-02 09:11:36 +0100

Seen: 664 times

Last updated: Dec 02 '13