stupid question about os.listdir

Jason Kratz eat at joes.com
Thu Jun 26 23:25:17 EDT 2003


Ben Finney wrote:
> On Fri, 27 Jun 2003 03:06:04 GMT, Jason Kratz wrote:
> 
>>Ben Finney wrote:
>>
>>>Please reduce the problem to a simple script
>>
>>Ben...I tried the above in a new script file (with print os.listdir)
>>and it works as I thought my other should.   Which means i'm doing
>>something wrong when passing the path in to my function but I'm not
>>sure what.  ugh.
> 
> 
> Congratulations!  You've learned an immensely valuable debugging
> technique:  Reduce the problem behaviour to the *minimum necessary code*
> to reproduce the problem; otherwise, you're searhing in code that, it
> turns out, has absolutely no bearing on the problem.
> 
> (This leads, in turn, to the principle that writing less code in the
> first place leads to fewer bugs -- but that will come naturally as you
> learn Python :-)
> 

aha!   I found it!   its the call to os.path.isdir.   I'm not passing it 
a real pathname....just a string.  I need to set my entries in my dir 
list as real pathnames (ie: with the slashes)...not just the text. 
question is how ;)





More information about the Python-list mailing list