Importing CPython 2.6 Standard Library

Nov 14, 2008 at 2:55 PM
Edited Nov 14, 2008 at 3:10 PM
I'm trying get access to the standard libraries in IronPython Studio. i've put in the following code

import sys

import os

But I get and error on import os that it's an "unexpected token." I also have IronPython 2.0 RC1 running on the command line and by changing the file i can access the standard libraries.

Thanks in advance

edit: I am able to import os from CPython 2.4 and CPython 2.5, so I guess I'd just like a brief explanation if anyone has a better understanding of this








Mar 16, 2009 at 11:02 PM
It seems a lot of people are having the same issue " Not being able to impor os or standard libs in IronPython 2.0"  how come there are no responds to this issue, its the biggest issue with IronPython Studio.
Mar 17, 2009 at 8:36 PM
Hi I figured out how to get os working in IronPython Studios.

1.  add the following lines before you import os



.path.append(r"C:\Program Files (x86)\IronPython 2.0.1")




.path.append(r"C:\Program Files (x86)\IronPython 2.0.1\Lib")

2.    import os

3. If you need to use CPython, then get PythonNet from.   After you have made your UI make sure import clr is befor import System. 

4. comment out all the lines starting with @  and the __slots__ line.

5. now in another IDE use all the CPython modules you need.  I import a dummy version of my python functions for testing, then replace the import for the final product.

6. I know this is a hack, but for now I guess we have to deal, at least this way you can use the gui building tools and it's better than WX, I think :(