[IronPython] WPF module in IronPython scripting?
dinov at microsoft.com
Fri Apr 15 18:38:23 CEST 2011
> Hi there everyone,
> I just bumped into a problem where when I run the IPy.exe console and
> execute a script that contains:
> import wpf
> all works well. However, when I want to import the wpf namespace into the
> same script, but run outside the IPy.exe (i.e. as an embedded engine) I get
> an error saying that the module wpf doesn't exist!
> I even tried to add the IronPython.Wpf.dll into the PATH, I tried referencing
> it in my script via clr.AddReferenceToFile, nothing works and I don't have
> access to the wpf methods etc...
> Is there anything I can do about it?
I would have expected AddReferenceToFile to work but what about doing a
scriptRuntime.LoadAssembly(typeof(Wpf).Assembly); where the host app
has a reference to IronPython.Wpf.dll?
I think the code for loading from the DLLs directory is ipy.exe specific - you could
also look at replicating that for your host app so there's a general way to add
additional Python built-in modules.
More information about the Ironpython-users