open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

gert gert.cuykens at gmail.com
Sat May 16 09:40:02 EDT 2009


On May 16, 3:16 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> gert schrieb:
>
> > open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
> > 'rb')
> > how do you do this on windows (py3) so it still works on linux ?
>
> os.path.join("..", "www", "bin", "picture.png")
>
> Or use os.sep.
>
> Diez

IOError: [Errno 2] No such file or directory: 'C:\\Users\\gert\\Desktop
\\koen\\a
ppwsgi/wsgi\\..\\www\\bin\\picture.png'

The os.path.dirname(__file__) is still in posix mode ?




More information about the Python-list mailing list