[Python-au] blind spot with os.path

Mike Dewhirst miked at dewhirst.com.au
Thu Oct 15 23:23:07 UTC 2009


John Machin wrote:
> On 15/10/2009 8:21 PM, Mike Dewhirst wrote:
>> The problem I find is that Python seems to be using the wrong default 
>> path separator here ...
>>
>> 'C:\\users\\miked\\py\\chemdata\\src\\getmsds\\testlinks\\leave_empty/*.*' 
>>
>>
> [snip]
> 
>>         filesdir = testdir + os.path.sep + emptydir
> 
> This is not the cause of your problem, but IMHO it's better to use
>     os.path.join(this, that)
> always instead of translating that to
>     this + os.path.sep + that
> sometimes.

John

You are right. You have also reminded me that I actually tried that and 
had the same result. That was when I took the "this + os.path.sep + 
that" road, blindly flailing about bashing my head against the cell walls.

I sometimes think I'll never learn to read the error messages. You could 
never trust them in the eighties. No Python you see!

I'm much happier nowadays :)

Cheers

Mike
> 
> Cheers,
> John
> 
> 




More information about the python-au mailing list