[Ironpython-users] Dotted assembly names and import

Geoffrey Bantle gbantle at gmail.com
Sun Feb 19 01:27:39 CET 2012


Hi Keith,

Thanks for your response. I actually am familiar with python's import
statement as I have been
programming in python for years now :) I'm afraid I don't see how your
response answers my
question about dotted assembly names and python code compiled with pyc.py.
Could you maybe
clarify for me?

Maybe this is all by design and I just shouldn't be trying this. But it
seems to me that in order to
make pyc.py useful there should be the possibility to implement
package/module hierarchies
and unless I am mistaken the only way you can do that now is if your
application runs from source.

Best Regards,
Geoffrey Bantle

On Sat, Feb 18, 2012 at 6:41 PM, Keith Rome <rome at wintellect.com> wrote:

> 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 <rome at wintellect.com>****
>
> 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****
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120218/f76e73f9/attachment.html>


More information about the Ironpython-users mailing list