[IronPython] os.path functions give wrong result on non-Windows platforms

Dino Viehland dinov at exchange.microsoft.com
Thu Dec 29 17:33:42 CET 2005

Good catch...  Another solution might be for us to implement ntmath as a built-in module that delegates to the BCL's path functionality which should get it right on a per-platform basis (or have cli recognized as it's own platform and have a clipath.py that does the right thing).

I'll add this to our bug list but I don't know that we'll be able to get this one fixed for the next release.  Your work around seems like a decent enough one for now.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Wednesday, December 28, 2005 10:06 PM
To: users at lists.ironpython.com
Subject: [IronPython] os.path functions give wrong result on non-Windows platforms

Currently, os.path module is same as ntpath, and gives wrong result on
non-Windows platforms.

IronPython 0.9.6 on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import os
>>> os.path.join('a', 'b')

Currently, I have the following code in my site.py, but obviously this
is not the correct solution:

import System
import os
if str(System.Environment.OSVersion.Platform) == 'Unix':
    import posixpath
    os.path = posixpath

Any idea?

Seo Sanghyeon
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list