Where is walk.py located after I attach walk.sage?

i like this post (click again to cancel)
1
i dont like this post (click again to cancel)

The sage tutorial Loading and Attaching Sage files states that if I create a file such as walk.sage containing:

print "Hello world"
print 2^4

and then load or attach it:

sage: attach 'walk.sage'
Hello world
16

I should get a walk.py file containing python code in the same directory as walk.sage. I can find no such file (I've even searched my the rest of my computer). Does anyone know where the file is?

asked Nov 17 '11

rtrwalker gravatar image rtrwalker
117 1 4 12

updated Nov 17 '11

i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel) rtrwalker has selected this answer as correct

(Edit: I originally thought that there wasn't a file walk.py, but I think that's wrong.)

Look in $HOME/.sage/temp/DIR0/DIR1/ where $HOME is your home directory, DIR0 has a name like $HOSTNAME and DIR1 is a number, the process id of the Sage process. This directory is deleted when you quit Sage.

If you want to produce a more permanent file walk.py, then from your shell prompt, run sage --preparse walk.sage. This will produce walk.py in the current directory.

link

posted Nov 17 '11

John Palmieri gravatar image John Palmieri flag of United States
2700 9 23 60
http://www.math.washingto...

updated Nov 17 '11

Nice - that is useful! But of course there is a walk.py ;-)

kcrisman (Nov 17 '11)
1

If my ultimate goal is to write some sort of package, is there any point to me writing *.sage files in the first place or should I start out writing *.py scripts and use "from sage.all import *" and prepend all the sage-functions I use with "sage.all."?

rtrwalker (Nov 17 '11)

Also, I wonder if sometimes it does create walk.py in the proper directory. At least, I have some .py files I didn't create that are in the same directory as the .sage files I use for my research. But I always have to call them with the full /path/to/file.sage, so maybe that makes a difference as opposed to rtwalker's use case...

kcrisman (Nov 17 '11)

@rtwalker: I think that to start off, the advantage of the .sage files is that you get a quick start and can see what happens. Then when you make .py files out of them, you can later (usually by trial and error) figure out what you actually need to important, rather than doing the nasty import * trick. But everyone has a different preferred work flow, it's up to what makes you comfortable and productive.

kcrisman (Nov 17 '11)

@John Palmieri after repeating my procedure I still could not find walk.py in the directory that you suggested (all there was was an empty 'interface' directory. Regardless, with your sage --preparse suggestion I can force sage to make me a walk.py file. Thanks

rtrwalker (Nov 17 '11)
see 2 more comments

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: Nov 17 '11

Seen: 79 times

Last updated: Nov 17 '11

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.