[Ironpython-users] Dotted assembly names and import

Keith Rome rome at Wintellect.com
Sun Feb 19 00:41:35 CET 2012


The import statement is used for namespaces, which usually (but don't have to) match the assembly names. You reference the assembly once, and import whatever types/namespaces you need from it. Thinking of it in another way, referencing the assembly grants the ability to import from that assembly. But in itself it does nothing apparent from the perspective of the consuming script.

This is similar to how C#/VB work where you reference the assembly once for your project, and then you place using/import statements at the top of individual code files to bring the types contained within the assembly into scope.



Keith Rome
Senior Consultant and Architect
MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS
Wintellect | 770.617.4016 | krome at wintellect.com<mailto:rome at wintellect.com>
www.wintellect.com<http://www.wintellect.com/>

From: ironpython-users-bounces+rome=wintellect.com at python.org [mailto:ironpython-users-bounces+rome=wintellect.com at python.org] On Behalf Of Geoffrey Bantle
Sent: Saturday, February 18, 2012 6:07 PM
To: ironpython-users at python.org
Subject: [Ironpython-users] Dotted assembly names and import

Hello,

I have a question about assemblies compiled with pyc.py. If you just name
them normally like, "Foobar.dll" or "Snafu.dll" you can add a reference
to them and import them into IronPython as one would expect. If however
you name them like "Foobar.Snafu.dll" you can add a reference to them
but it does not seem like you can import them at all. You are given the error:

"ImportError: No module named Snafu"

Is this intended behavior? My understanding is that dotted assembly names
are quite common in .Net and I have a project where I would like to have
assemblies compiled by pyc.py to sit side by side with assemblies written
in C#. Maybe this is not the natural way to do things?

Any help is appreciated.

Best Regards,
Geoffrey Bantle
gbantle at gmail.com<mailto:gbantle at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120218/70e94cf1/attachment.html>


More information about the Ironpython-users mailing list