3
votes

I have both Aptana Studio 3 and Eclipse 4.2.1 (w/ PyDev & PyDev extensions) installed on Windows XP (SP3) systems. I have been unsuccesful in loading external .NET assemblies. Given the assembly myassembly.dll containing a namespace myNameSpace, I set up a new project with the IronPython interpreter selected. In the src folder of my project I make a Python file 'Test.py' containing 3 statements:

import clr
clr.AddReferenceToFile('myassembly.dll')
import myNameSpace

I always get an unresolved import on the 3rd statement with both Aptana Studio and Eclipse

  1. I have modified the 2nd statement to use clr.AddReferenceToFileAndPath('Fully qualified path and file name')

  2. I have also tried adding the path to an external library and placing my assembly in that library with the same results.

The 3 statements execute fine from the IronPython console. Also, imports of .NET System and other modules work OK. But presumably these modules are registered in the GAC.

This seems to be unique to the IronPython interpreter and the final PYTHONPATH. I have path references to the project src folder and to an external source folder, both of which contain the assembly. What am I missing here?

1
I think PyDev just can't do that, since it really has no way to statically analyze your dll! - moschlar

1 Answers

0
votes

I haven't actually tested it, but this is usually the case for the forced builtins (see the forced builtins section at http://pydev.org/manual_101_interpreter.html).

Still, it won't do the:

import clr
clr.AddReferenceToFile('myassembly.dll')

So, if that't really required, you may edit the file: eclipse\plugins\org.python.pydev_XXX\pysrc\pycompletionserver.py

and add that code (before the if sys.platform == "darwin") for the import to work in the forced builtins.