[IronPython] Being unable to import module after succesfully adding reference, in asp.net IronPython

Jimmy Schementi Jimmy.Schementi at microsoft.com
Wed Mar 31 04:56:40 CEST 2010

Let me see if understand your question:

You have funciones.dll and your trying to use it in IronPython like this:

import clr
from funciones import *

First off, I'm not sure the contents of funciones.dll. You mentioned "conexiones" as the namespace, but I'm not sure if that was part of the question. Anyway, when doing "import foo", "foo" represents some top-level name that IronPython can find, be it a file on disk, a Python module, or a top-level name in a .NET DLL you have added a reference to. The actual DLL file name is not related to the name you use when using import. For example, IF funciones.dll was compiled from this C# code:

public static class MyFunctions {
  public static void Function1() {}
  public static void Function2() {}

You would do the following to use it:

import clr
import MyFunctions

Make sense?

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Pablo Dalmazzo
Sent: Monday, February 22, 2010 4:51 AM
To: users at lists.ironpython.com
Subject: [IronPython] Being unable to import module after succesfully adding reference, in asp.net IronPython

Hi there,
I'm adding a reference to a funciones.dll file using
clr.AddReferenceToFileAndPath() because I couldnt get it to work other way with this file and it succesfully does it. The file is named funciones.dll , it only contains function definitions and it's in the bin folder. But when I do

from funciones import *
I get "no module named funciones"
since the funciones.dll file it's a funciones.py file compiled, shouldnt the module name only be named funciones and no any other name? isnt the name the problem and it's another? I dont know what other info could be relevant here but if there is any let me know.

BTW, in the VS 2008 object explorer, this assembly is listed differently than assemblies made from VB.NET or C#

code files. A dll file made from a VB.NET code file named "conexiones" with a explicity declared "conexiones" namespace
is listed as

{}conexiones : "Namespace conexiones, member of conexiones".

The IronPython assembly funciones is listed as

DLRCachedCode[funciones]: "public class DLRCachedCode, member of funciones"

My question is , what do I have to do for the function definitions from funciones.dll to be available from an asp.net
ironpython aspx.py codefile ?

Greetings, Pablo Dalmazzo


Hotmail es confiable. Con autenticación de remitentes y filtros Anti-Spam mejorados un 80% . Ver más.<http://www.descubrewindowslive.com/hotmail/anti-spam.asp>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100331/27888100/attachment.html>

More information about the Ironpython-users mailing list