[IronPython] importing os module

J. Merrill jvm_cop at spamcop.net
Tue Nov 1 21:02:03 CET 2005

Others know more than I do, but writing a CPython module in C interacts very significantly with mechanisms that are internal to the Python interpreter, and needs to be involved with the reference-counting mechanism that's the basis of CPython's garbage collector (when IronPython uses the .Net collector and doesn't use reference counting).  Also, a CPython C-coded module manipulates data structures that actually ARE the internal data structures of the interpreter.  The IronPython interpreter shares none of those structures.

There are also the usual .Net-notions that C is inherently unsafe and it would be much better if you could build IronPython apps in "100% managed code" (not yet possible IINM).

Hopefully if I've said something wrong, someone who knows more will holler.

At 12:08 PM 11/1/2005, Michael Gogins wrote
>Why does it not play with C? Surely this would be immensely helpful.
>-----Original Message-----
>From: "J. Merrill" <jvm_cop at spamcop.net>
>Sent: Nov 1, 2005 10:06 AM
>To: Discussion of IronPython <users at lists.ironpython.com>
>Subject: Re: [IronPython] importing os module
>IP does indeed "not play with C at all".  The plan, I believe, is to re-create some common C-based Python libraries (with C# or in Python) to ease the porting.
>At 02:09 AM 11/1/2005, Liam Clarke wrote
>>Now, my question on os is, what does IronPython have against pipe() ?
>>Does IronPython not play with C at all?
>>Liam Clarke
>>On 11/1/05, Martin Maly <Martin.Maly at microsoft.com> wrote:
>>> You can set sys.path to point to CPython's Lib directory which includes os
>>> module:
>>> >>> import sys
>>> >>> sys.path.append("C:\\Python24\Lib")
>>> >>> import os
>>> >>> os.name
>>> 'nt'
>>> You can even put the first 2 lines into your site.py (located in
>>> IronPython's Bin\lib directory)
>>> Martin

J. Merrill / Analytical Software Corp

More information about the Ironpython-users mailing list