Ask Your Question
1

Running sage on an input file via the command line

asked 2013-12-02 02:11:36 -0500

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
1

answered 2013-12-02 02:35:24 -0500

tmonteil gravatar image

updated 2013-12-02 02:37:34 -0500

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:

sleep(100)

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

Comments

Thanks! Problem solved.

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

Stats

Asked: 2013-12-02 02:11:36 -0500

Seen: 198 times

Last updated: Dec 02 '13