Suggestion for os.path.join

Mark Hadfield m.hadfield at niwa.cri.nz
Wed May 23 19:16:26 EDT 2001


From: "David Morgenthaler" <boogiemorg at aol.com>
> We use os.path.join() extensively to keep our code platform
> independent. But we sometimes have problems on win32 when the
> resulting path is passed to a C-extension -- not all C-extensions
> (e.g., gdchart) are smart enough to handle the result.
>
> Example:
> Python 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE 0.8 -- press F1 for help
> >>> PATH = 'D:/SARCrates/SARBoxResults'
> >>> import os
> >>> outfile = os.path.join(PATH,"subdir","outfile.png")
> >>> print outfile
> D:/SARCrates/SARBoxResults\subdir\outfile.png
> >>>
>
> The combination of '/'s and '\'s in the resulting path are not handled
> by gdchart.chart. I have similar problems with the PIL's ImageFont,
> etc.

There's your problem right there:

> >>> PATH = 'D:/SARCrates/SARBoxResults'

Why put '/'s in a Windows path in the first place?

---
Mark Hadfield
m.hadfield at niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research

Gratuitous new text to fool news server. Gratuitous new text to fool news
server. Gratuitous new text to fool news server. Gratuitous new text to fool
news server. Gratuitous new text to fool news server. Gratuitous new text to
fool news server. Gratuitous new text to fool news server. Gratuitous new
text to fool news server. Gratuitous new text to fool news server.
Gratuitous new text to fool news server. Gratuitous new text to fool news
server. Gratuitous new text to fool news server. Gratuitous new text to fool
news server. Gratuitous new text to fool news server. Gratuitous new text to
fool news server. Gratuitous new text to fool news server. Gratuitous new
text to fool news server. Gratuitous new text to fool news server.
Gratuitous new text to fool news server. Gratuitous new text to fool news
server.


-- 
Posted from clam.niwa.cri.nz [202.36.29.1] 
via Mailgate.ORG Server - http://www.Mailgate.ORG



More information about the Python-list mailing list