[IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight

Michael Foord fuzzyman at voidspace.org.uk
Sun Apr 6 15:27:06 CEST 2008

Vineet Jain (gmail) wrote:
> I’m building my first silverlight application and wanted to use a good 
> templating library (preppy from reportlab 
> http://www.reportlab.org/downloads.html ) in ironpython. The main 
> problem that I’m having now is with
> import py_compile
> py_compile.compile(srcFileName,
> cfile=directory + os.sep + name + '.pyc',
> dfile=name + '.py')
> When I try to import py_compile from python it fails. Is there any way 
> to compile and load a python source file from a text string and not 
> have to save the file to the filesystem?

I'm not familiar with preppy - but IronPython doesn't support loading or 
saving compiled Python bytecode files (IronPython uses a different 
bytecode format altogether).

You also can't write to the filesystem from Silverlight. You can read 
files that are contained in the '.xap' file (your dynamic application) - 
but you have to use 'file' rather than 'open'.

I'm afraid you will actually have to dig into "py_compile.compile" to 
see if there is a workaround what it is trying to do.

Michael Foord

> Thanks,
> Vineet
> ------------------------------------------------------------------------
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

More information about the Ironpython-users mailing list