Ask Your Question
4

Cleaning up after %attach in 5.7

asked 2013-03-05 10:54:17 +0200

csar gravatar image

updated 2023-01-10 00:01:08 +0200

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?

edit retag flag offensive close merge delete

Comments

csar gravatar imagecsar ( 2013-03-05 10:56:06 +0200 )edit

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

kcrisman gravatar imagekcrisman ( 2013-03-05 11:28:12 +0200 )edit
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 ( 2013-03-05 15:10:48 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-05-14 08:16:26 +0200

Volker Braun gravatar image

updated 2013-05-14 13:13:51 +0200

kcrisman gravatar image

Fixed in #14523

edit flag offensive delete link more
0

answered 2013-05-12 19:04:07 +0200

David Bailey gravatar image

updated 2013-05-13 09:42:17 +0200

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.

edit flag offensive delete link more

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 ( 2013-05-12 20:39:05 +0200 )edit
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 ( 2013-05-13 09:50:43 +0200 )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

1 follower

Stats

Asked: 2013-03-05 10:54:17 +0200

Seen: 416 times

Last updated: May 14 '13