[IronPython] Importing in a background thread
Dan Eloff
dan.eloff at gmail.com
Sat Nov 22 17:00:33 CET 2008
On Fri, Nov 21, 2008 at 10:09 PM, Dino Viehland <dinov at microsoft.com> wrote:
> If you're getting crazy and are willing to experiment you could also look at IL rewriting compiled modules so they target Silverlight. In theory it's just updating what assembly name we're targeting.
I've been seriously considering that. Better still is if I can do the
parallel import optimization on top of compiled modules.
> Maybe I've just not been following the Silverlight threads close enough but what do you mean by "if __import__ works"? And how does importing in a background thread fail?
Here's a look at the problem in the soon to be released 0.6 version of
SilverShell:
IronPython 2.0 (2.0.5.0) on SILVERLIGHT (.NET 2.0.31005.0)
Switching execution to background thread.
>>> import datetime # builtins work
>>> import a
ImportError: No module named a
>>> __import__('a')
ImportError: No module named a
Switching execution to main user-interface thread.
>>> import a # works
Switching execution to background thread.
>>> import a # works now
There is no problem when running this on the desktop version of SilverShell.
IronPython 2.0 (2.0.0.0) on CLI (.NET 2.0.50727.3053)
Switching execution to background thread.
>>> import datetime
>>> import a
This does go through exec or eval, but the problem exists when run
without that as well. This is in RC1, I haven't tested anything newer
against this problem.
-Dan
More information about the Ironpython-users
mailing list