This should work:
import clr
import System.Reflection
clr.AddReference(System.Reflection.Assembly.LoadFrom('/code/dlls/Microsoft.Office.Interop.PowerPoint.dll')); clr.AddReference(System.Reflection.Assembly.LoadFrom('/code/dlls/office.dll)); import Microsoft.Office.Interop.PowerPoint as PP import Microsoft.Office.Core as Core
the key is the change from AddAssembly to AddReference.
It's unfortunate you were using AddAssembly as it's really only there for compiled scripts to add themselves into the list of available assemblies (and the way we do that changed from using references to assemblies in beta 5), not for usage in scripts. It
takes a string now instead of an assembly, which is the reason why you're getting that exception. We should move this out of clr to avoid future confusion.
Sent: Wednesday, April 05, 2006 6:40 PM To: Discussion of IronPython Subject: [IronPython] Assembly differences in Beta5
With the switch to Beta5, my assembly loading is not working (again).
Among other modules, I'm using the Microsoft Office Interop modules:
I used to be able to do the following:
import clr
import System.Reflection
clr.AddAssembly(System.Reflection.Assembly.LoadFrom('/code/dlls/Microsoft.Office.Interop.PowerPoint.dll')); clr.AddAssembly(System.Reflection.Assembly.LoadFrom('/code/dlls/office.dll)); import Microsoft.Office.Interop.PowerPoint as PP import Microsoft.Office.Core as Core
now, this says, TypeError, bad args for method (on the AddAssembly line)
I've also used just about every combination of AddReferenceByName, PartialName, FromFile, LoadAssembly, etc. that I can think of.
None of them work anymore...usually, they crap out on the import.
What's the preferred/correct/possible way of doing this now?
Thanks!
--Steve |
_______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com