Importing CPython 2.6 Standard Library

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

import sys
sys.path.append(r'C:\Python26\Lib')

import os
os.getcwd()
 


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 site.py 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 17, 2009 at 12:02 AM
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 9:36 PM
Hi I figured out how to get os working in IronPython Studios.

1.  add the following lines before you import os

    sys

 

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

 

    sys

 

.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.  http://feihonghsu.blogspot.com/2008/02/installing-pythonnet-20-alpha-2-on.html   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 :(