[IronPython] Loading Python modules from Silverlight Isolated Storage

Dino Viehland dinov at microsoft.com
Tue Nov 4 07:51:26 CET 2008


...
import imp
foo = imp.new_module('foo')
...

is a step in the right direction.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher
Sent: Monday, November 03, 2008 10:45 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Loading Python modules from Silverlight Isolated Storage

You should be able to do this all in-memory:

>>> import sys
>>> foo = type(sys)('foo')
>>> sys.modules['foo'] = foo
>>> exec 'a = 1' in foo.__dict__
>>> foo.a
1
>>>

There's probably a better ("more Pythonic") way to do this, but I'm sleepy...
On Mon, Nov 3, 2008 at 11:40 PM, Kenneth Miller <xkenneth at gmail.com<mailto:xkenneth at gmail.com>> wrote:
All,

  Is it possible to have python load modules from the silverlight isolated storage? My app needs to dynamically generate and import python code to run.

Regards,
Ken
_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081103/1e5edbf0/attachment.html>


More information about the Ironpython-users mailing list