First time here? Check out the FAQ!

Ask Your Question
1

os.path.isdir()

asked 14 years ago

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
3

answered 14 years ago

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
Preview: (hide)
link

Comments

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

John Palmieri gravatar imageJohn Palmieri ( 14 years ago )

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

Mike Witt gravatar imageMike Witt ( 14 years ago )
0

answered 14 years ago

ccanonc gravatar image

updated 14 years ago

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

Preview: (hide)
link

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: 14 years ago

Seen: 8,151 times

Last updated: Sep 09 '10