[Python.NET] Accessing custom module

Craig Farrow craig_farrow at sil.org
Fri Jun 6 10:45:53 CEST 2008


Hi,

I'm trying to access a custom .NET Assembly with Python .NET, but can't
get it to recognise the Assembly name space. IronPython works fine in
the code below. Any clues? I'm using the Python .NET build from here:
http://sourceforge.net/project/showfiles.php?group_id=162464


-------------------------
import sys
GLOBAL_IRONPython = "Iron" in sys.version

# Need full path (or could add the path to sys.path)
FDO_DLL_PATH = "c:\\program files\\sil\\fieldworks\\FDO.dll"

import clr

if GLOBAL_IRONPython:
    print "IRON Python Startup"
    clr.AddReferenceToFileAndPath(FDO_DLL_PATH)
else:
    # Python .NET
    print "Python .NET Startup"
    from System.Reflection import Assembly
    fdo = Assembly.LoadFile(FDO_DLL_PATH)
   
# This is failing in Python .NET  -- "No module named
SIL.FieldWorks.FDO"!   
from SIL.FieldWorks.FDO import FdoCache     

db = FdoCache.Create("DB-name")      
print db.ServerName, db.DatabaseName
-------------------------

I've also tried clr.AddReference("SIL.FieldWorks.FDO"), but that reports
"Unable to find assembly 'SIL.Fieldworks.FDO'."

Thanks,

Craig.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20080606/772db95c/attachment.htm>


More information about the PythonDotNet mailing list