Ask Your Question
1

Running sage on an input file via the command line

asked 11 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

tmonteil gravatar image

updated 11 years ago

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
Preview: (hide)
link

Comments

Thanks! Problem solved.

sjr gravatar imagesjr ( 11 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

Stats

Asked: 11 years ago

Seen: 805 times

Last updated: Dec 02 '13