[Tutor] os.path.join on windows 2000

Jeff Shannon jeff@ccvcorp.com
Wed, 06 Feb 2002 09:34:23 -0800

> Danny Ruttle <danny@intuitivemedia.com> wrote:
> Sorry about that - I was trying a few directories during tests.
> The following call generates the same exception.
> if __name__ == "__main__":
>      my_instance = line_parser("c:/test","s.txt","test1.txt")
> Any ideas?

My suspicion is that you'll have to abandon the idea of using forward slashes.  Really, you're not benefiting
your cross-platform capabilities by it--if you're hardcoding in a "C:", then you might as well use a \ when
you're hardcoding pathnames.  Once you've *got* a starting point, if you only use the os.path functions to
modify the path, then you'll be perfectly cross-platform, but you're going to need to do something to address
the different ways of handling filesystem roots anyhow.

Have you tried simply using "C:\\test" in the above example?  Unless that fails too (and it shouldn't), then
simply dealing with platform-specific differences there will probably be easier than mucking about changing
attributes of os.  (You could write a function like GetFilesystemRoot() that tests the os module for system
type, and returns 'c:\\', '/', etc.)

Jeff Shannon
Credit International