Re: os.chdir

2008-03-08 Thread rbossy
Quoting "Martin v. Löwis" <[EMAIL PROTECTED]>: > >> os.chdir("~/dir1") > > > > It is not mentioned in the documentation but I'm pretty sure os.dir() > doesn't do > > tilde expansion since this is usually performed by a shell. > > > > You should use instead: > > > > os.chdir(os.join(os.environ['HOM

Re: os.chdir

2008-03-08 Thread Martin v. Löwis
>> os.chdir("~/dir1") > > It is not mentioned in the documentation but I'm pretty sure os.dir() doesn't > do > tilde expansion since this is usually performed by a shell. > > You should use instead: > > os.chdir(os.join(os.environ['HOME'], 'dir1')) Or os.chdir(os.path.expanduser("~/dir1")) R

Re: os.chdir

2008-03-08 Thread rbossy
Quoting Maryam Saeedi <[EMAIL PROTECTED]>: > I have a problem using os.chdir on linux. What should I do if I want to > change to root directory? The below does not work: > > os.chdir("~/dir1") It is not mentioned in the documentation but I'm pretty sure os.dir() doesn't do tilde expansion since t

Re: os.chdir

2008-03-07 Thread Michael Wieher
2008/3/7, Maryam Saeedi <[EMAIL PROTECTED]>: > > I have a problem using os.chdir on linux. What should I do if I want to > change to root directory? The below does not work: > > os.chdir("~/dir1") > > Thanks > > -- > http://mail.python.org/mailman/listinfo/python-list > >>> os.getcwd() '/home/micha

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread DataSmash
A simple way to get all the files throughout the directory sturcture... You may have to rewrite the "CONVERTING" part. import os, glob for root, dirs, files in os.walk(os.getcwd()): for file in files: if file.endswith(".mp3"): print "File: " + os.path.abspath(os.path.join(

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > #!/usr/bin/python > > from os import * > > chdir("/home/chainlynx/Desktop/Music") > for artist in listdir(getcwd()): > print "===ARTIST: "+artist > chdir(artist) > for album in listdir(getcw

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread BartlebyScrivener
>> for album in listdir(getcwd()): doesn't listdir give you subdirectories AND files? So, then if you try to: chdir(album) If album is a file, it chokes? Just a guess. I'm on Windows, not Linux. rd -- http://mail.python.org/mailman/listinfo/python-list