[TIP] os-independent file paths
andrea.crotti.0 at gmail.com
Thu Dec 8 05:22:12 PST 2011
Testing functions which work on the file system I would like to be able
to use some paths, both on Windows and on Linux.
Now the problem is that paths are different on the two platforms, so my
ideas was to have something like
And import it where needed as
import utils.unix_to_independent_path as _
to use like
The problem is that the function doesn't really work for example for
unix absolute paths
/very/long/path -> very/long/path.
And in general how would that path convert to a Windows path anyway?
So I guess I should only use relative paths, does it make sense?
More information about the testing-in-python