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

gert gert.cuykens at gmail.com
Sat May 16 09:45:32 EDT 2009


On May 16, 3:40 pm, gert <gert.cuyk... at gmail.com> wrote:
> 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 ?

DOH!!! forgot to actually put the file in the directory :)
works both ways never mind the question, thanks.



More information about the Python-list mailing list