Ask Your Question
1

os.path.isdir()

asked 2010-09-09 04:30:24 -0500

Mike Witt gravatar image

Should the following work, or am I doing something wrong?

[mike@Vector ~]$ export MIKES_DIR=/home/mike/
[mike@Vector ~]$ /usr/local/sage-4.5.2/sage
----------------------------------------------------------------------
| Sage Version 4.5.2, Release Date: 2010-08-05                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: os.system('echo $MIKES_DIR')
/home/mike/
0
sage: os.path.isdir('/home/mike/')
True
sage: os.path.isdir('$MIKES_DIR')
False

I ask this because isdir() appears to be used in one of the scripts for building ATLAS to test whether you're trying to use system-wide atlas libraries, and I'm having trouble getting that to work.

-Mike

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2010-09-09 04:42:53 -0500

mvngu gravatar image

You could try this:

[mvngu@sage sage-4.5.3]$ echo $DOT_SAGE
/dev/shm/mvngu/dot_sage
[mvngu@sage sage-4.5.3]$ ./sage
----------------------------------------------------------------------
| Sage Version 4.5.3, Release Date: 2010-09-04                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: os.path.isdir(os.getenv("DOT_SAGE"))
True
edit flag offensive delete link more

Comments

Or as in the ATLAS spkg, os.path.isdir(os.environ['$MIKES_DIR']).

John Palmieri gravatar imageJohn Palmieri ( 2010-09-09 04:46:32 -0500 )edit

OK, I see now. I missed the getenv() part. Duh.

Mike Witt gravatar imageMike Witt ( 2010-09-09 04:57:19 -0500 )edit
0

answered 2010-09-09 06:58:22 -0500

ccanonc gravatar image

updated 2010-09-09 06:59:01 -0500

sage: os.environ['MYVAR']
'/home'
sage: os.path.isdir(os.environ['MYVAR'])
True

edit flag offensive delete link more

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: 2010-09-09 04:30:24 -0500

Seen: 7,083 times

Last updated: Sep 09 '10