On Oct 19, 6:00 am, Marcin201 <[EMAIL PROTECTED]> wrote: > Is there an built-in functionality in python to convert Windows paths > to Unix paths? I am running into problems when creating data files on > Windows and the running them on a Unix platform. I create paths using > os.path.join. > > os.path.join('Pictures', '01.jpg') returns 'Pictures\\01..jpg' on > Win. When I read files created on Win under Unix this is a problem, > python cannot open 'Pictures\\01.jpg' >
Note that os.path.join('Pictures', '01.jpg') returns 'Pictures/01.jpg' on Unix. Note that 'Pictures\\01.jpg' == r'Pictures\01.jpg' i.e. there is only one backslash. Have you considered unix_path = windows_path.replace('\\', '/')? -- http://mail.python.org/mailman/listinfo/python-list