stupid question about os.listdir

Jason Kratz eat at joes.com
Thu Jun 26 22:25:16 EDT 2003


Jason Kratz wrote:
> OK. I've search on google groups and around the web for this and I 
> haven't found an answer.  I'm a Python newbie and have what I assume is 
> a basic question.  os.listdir takes a pathname as an arg but it doesn't 
> actually list the contents of the dir I pass in.   it always operates on 
> the current dir (wherever the script is run) and I have to chdir 
> beforehand.  Is that how its supposed to work?  If so what is the point 
> in passing in a pathname?
> 
> thanks,
> 
> Jason
> 

oops.  almost forgot.  if I run interactively in the python interpreter 
it works as I expect.  its when doing 'python script.py' from the 
command line that it only uses the current directory.





More information about the Python-list mailing list