First time here? Check out the FAQ!

Ask Your Question
4

Cleaning up after %attach in 5.7

asked 12 years ago

csar gravatar image

updated 2 years ago

tmonteil gravatar image

In 5.7, when I attach a file, call it foo.sage, I get files called something like foo.sageQ7xLla and foo.sageQ7xLla.py created in the directory, plus a new pair every time foo.sage is altered. Obviously, this gets tiresome really quickly. Is there a way to get sage to create this files wherever it was doing it before (some tmp directory, I assume) or to clean up after itself on exit?

Preview: (hide)

Comments

csar gravatar imagecsar ( 12 years ago )

In fact, that should *still* address your question if you use `attach('foo.sage')` instead of `%attach foo.sage`.

kcrisman gravatar imagekcrisman ( 12 years ago )
1

It doesn't, though your comment in the other post describes what I'm talking about (though I never had this happen in earlier versions). Both `attach foo.sage` and `attach('foo.sage')` create the two new files in the working directory.

csar gravatar imagecsar ( 12 years ago )

2 Answers

Sort by » oldest newest most voted
3

answered 11 years ago

Volker Braun gravatar image

updated 11 years ago

kcrisman gravatar image

Fixed in #14523

Preview: (hide)
link
0

answered 11 years ago

David Bailey gravatar image

updated 11 years ago

I face the same issue eight years after the question was initially asked, while using Sage Version 5.9-OSX-64bit-10.8. I am using init.sage for the first time, and every time a notebook is opened, two files are created in the .sage directory with names like init.sageCfCKee and init.sageCfCKee.py. The mulitiple copies quickly obscure everything else in the folder. Surely these files are supposed to go into the tmp or temp directories. Perhaps I have somehow corrupted my Sage setup, but for now my quick solution on my OS X Mac is to add the following two lines to the beginning of my init.sage file:

from subprocess import call
call("rm -f /Users/username/.sage/init.sage?*", shell=True)

This deletes the two offending files before any of the other init.sage commands are executed. I include a similar two lines at the beginning of other .sage files that I want to attach or load, but with "init" replaced by the name of that file. These lines can be added to any .sage file that is creating such duplicates. (Note:"/Users/username/.sage" should be replaced by the location of your own .sage file.)

WARNING: I am uncomfortable doing "rm -f" in any program, and I am concerned that deleting the two files will cause some problem, but so far I haven't noticed anything. Be careful, since if you make a typing mistake (e.g. forget the "?"), you might delete something you want to keep. Use at your own risk.

Preview: (hide)
link

Comments

3

"Mar 05" means "the fifth of March (of the current year)", not March 2005. The ask-sage site was created in [August 2010](https://groups.google.com/forum/?fromgroups=#!topic/sage-devel/-54d7Q-qYWo).

slelievre gravatar imageslelievre ( 11 years ago )
1

Thanks for the clarification. Date ambiguities have caught me more than once. I am big fan of ISO (http://xkcd.com/1179/).

David Bailey gravatar imageDavid Bailey ( 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

1 follower

Stats

Asked: 12 years ago

Seen: 557 times

Last updated: May 14 '13