# Where is the default directory for outputting?

So I'm running Sage on OSX, and I'm using the function g.write_to_eps(), where g is a graph. One from the sage help pages is

 g = Graph({0:[6,7],1:[7,8],2:[8,9],3:[9,10],4:[10,11],5:[11,6],6:[0,5,7],7:[0,1,6],8:[1,2,9],9:[2,3,8],10:[3,4,11],11:[4,5,10]})


So I run that, then g.write_to_eps('sage.eps'), but I have no idea where it is supposed to show up. Could anybody help me with this? Probably a very easy answer, but I couldn't find a solid reply through Google. Sage is located in '/Applications/sage' and I'm in '/Users/jlv/'

Thanks!

P.S. To be more precise, where is the output executing the above commands from the browser notebook, not Terminal. Through Terminal things work as they should, as in g.write_to_eps('/Users/jlv/Desktop/sage.eps') appears on my Desktop.

edit retag close merge delete

Sort by » oldest newest most voted

From the notebook, evaluate the variable DATA; you'll get something like

'/Users/jlv/.sage/sage_notebook.sagenb/home/admin/42/data/'


(although probably with a different number than "42"). It looks to me as though the output directory for write_to_eps is obtained by replacing data with cells, or actually a subdirectory of

'/Users/jlv/.sage/sage_notebook.sagenb/home/admin/42/cells/'


Because of this, from the notebook, I often specify a full path when outputting: g.write_to_eps('/Users/jlv/Desktop/sage.eps'), for example.

more

Indeed, DATA was key. I can even see plots as .png files there! Super.

( 2012-10-09 14:25:39 -0600 )edit

It writes it in whatever directory you are in. When I start in SAGE_ROOT (the Sage folder):

sage: g = Graph({0:[6,7],1:[7,8],2:[8,9],3:[9,10],4:[10,11],5:[11,6],6:[0,5,7],7:[0,1,6],8:[1,2,9],9:[2,3,8],10:[3,4,11],11:[4,5,10]})
sage: g.write_to_eps('sage.eps')
sage: ls
COPYING.txt data@       ipython/    sage.eps
Makefile    devel/      local/      spkg/
VERSION.txt install.log sage*       tmp/


When I start in my home directory I get it there. So wherever you start Sage from, there it is! I guess that seems consistent with your other experience.

more