Path name of current directory 
Author Message
 Path name of current directory

How do I get the full pathname of the current directory?

i.e.

Not os.cwd() -> '.' but '/home/nickle' for an example.

--

Nick



Sun, 23 May 1999 03:00:00 GMT  
 Path name of current directory

Quote:

> Not os.cwd() -> '.' but '/home/nickle' for an example.

Hmm, os.getcwd() seems to give the full path for me.

--
Paul Everitt       Digital Creations

## python is my favorite language ##
##     http://www.python.org/     ##



Sun, 23 May 1999 03:00:00 GMT  
 Path name of current directory

Quote:
> How do I get the full pathname of the current directory?

os.getcwd() works fine for me (on Windows and Unix, at least...)

        /F



Sun, 23 May 1999 03:00:00 GMT  
 Path name of current directory

Quote:

> How do I get the full pathname of the current directory?

> i.e.

> Not os.cwd() -> '.' but '/home/nickle' for an example.

os.environ['PWD']

nick (the other one ;-)



Sun, 23 May 1999 03:00:00 GMT  
 Path name of current directory

Quote:
>>> os.environ['PWD']

    ^^^^^^^^^^^^^^^^^ -- This gives the ORIGINAL working directory
'/export/home013/pmiller'

Quote:
>>> os.curdir

    ^^^^^^^^^ -- This is the CHARACTER that REPRESENTS the working
directory
'.'

Quote:
>>> os.getcwd()

    ^^^^^^^^^^^ -- This COMPUTES the name of the current directory

Example:

Quote:
>>> import os
>>> [ os.environ['PWD'], os.curdir, os.getcwd() ]

['/export/home013/pmiller', '.', '/export/home013/pmiller']
Quote:
>>> os.chdir('/')
>>> [ os.environ['PWD'], os.curdir, os.getcwd() ]

['/export/home013/pmiller', '.', '/']

--
Patrick Miller

WWW   || http://www.caesoft.com/miller
Phone || (510) 423-0309 [LLNL], (209) 833-3459, (209) 833-6099 [FAX]



Mon, 24 May 1999 03:00:00 GMT  
 Path name of current directory

os.getcwd()



Tue, 25 May 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Making file path control only select directory paths not file names

2. Passing the current directory path to a variable - awk on a PC

3. Getting list of file names for current directory?

4. Directory listings and path names

5. Problem with glob and directory path names on Windows

6. Problem with glob and directory path names

7. good name for GET-CURRENT SWAP SET-CURRENT

8. os.path.split() with DOS path names

9. DOS File Lookup - just the file name, not the path AND file name

10. current VI's path

11. How can I get current path

12. Current Path Pointer in DMSII on Unisys V Series

 

 
Powered by phpBB® Forum Software