[Python.NET] getting started - can't import a simple dll

Jason Awbrey jason at awbrey.net
Wed Dec 15 02:47:29 CET 2010


Thanks.  I tried creating a test assembly with just a default constructor
and no other dependencies, and I get the same error when I try to import
it.

I also tried setting the path variable, through windows as well as in code,
and get the same result.

Assuming my dll is named "TestLib.dll", I should be able to do
clr.AddReference("TestLib"), correct?

Do I have to strong name my assemblies, or put them in the GAC?  Or is that
optional?

Any other suggestions of how to track this down?

On Tue, Dec 14, 2010 at 7:21 PM, Laszlo Sebo <
laszlo.sebo at primefocusworld.com> wrote:

>  It appears that some reference dependencies of the My.DLL assembly (the
> assembly containing HFF.Helper.Utilities ?) weren't found.
>
> Make sure that whichever referenced assembly has those classes is
> accessible through the path env variables. If needed, you can add it inside
> python, by simply doing something like:
>
> import sys
> sys.path.append('place where my dlls are')
>
> This is probably the best documentation out there:
> http://pythonnet.sourceforge.net/readme.html
>
> But once you get the initial assemblies to work, its fairly straightforward
> since you just use the .net classes natively from python.
>
>
> cheers,
> laszlo
>
>
>
> On 14/12/2010 4:53 PM, Jason Awbrey wrote:
>
> I'm evaluating PDN for use in an upcoming project.
>
> 1. installed Python 2.6.5
> 2. installed PDN - copied the clr.pyd file to Python's DLLs folder, and
> copied Python.Runtime.dll to Python's root
> 3. copy my dll (VS2010, simple C# class lib with two methods) into Python's
> root.
> 4. start python (using the python.exe from 2.6.5, not the one from PDN)
>
> >>> import clr
> >>> clr.AddReference("My.DLL")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> System.IO.FileNotFoundException: Unable to find assembly
> 'HFF.Helper.Utilities'.
>
>    at Python.Runtime.CLRModule.AddReference(String name)
> >>>
>
>  I assume I'm making some incredibly obvious newbie error.  Can anyone
> point me in the right direction?
>
> And, where can I find good docs/reference/discussion on using PDN?
>
> thanks - Jason
>
>
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20101214/88d691b0/attachment.html>


More information about the PythonDotNet mailing list