The point I was trying to make is that the assembly name (dots or no dots) has 
nothing to do with the contents of the assembly. It is simply a unique moniker. 
As far as I know, pyc.py emits the same MSIL into the resulting assembly no 
matter what you name the final file. And the namespaces within that assembly 
(which are what you would import) are associated with the source py file names. 
At least that's how it worked a few years ago, as described in this old ML 
thread: 
http://lists.ironpython.com/pipermail/users-ironpython.com/2008-August/008195.html

If you compile to Snafu.dll (or Foobar.dll) and then simply rename the 
resulting assembly file to Foobar.Snafu.dll, does your consuming code work? 
Also, what is the name of the py file you are compiling, and what does the 
import statement that is failing look like?



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

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

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 
<r...@wintellect.com<mailto:r...@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<tel:770.617.4016> | 
kr...@wintellect.com<mailto:r...@wintellect.com>
www.wintellect.com<http://www.wintellect.com/>

From: 
ironpython-users-bounces+rome=wintellect....@python.org<mailto:wintellect....@python.org>
 
[mailto:ironpython-users-bounces+rome<mailto:ironpython-users-bounces%2Brome>=wintellect....@python.org<mailto:wintellect....@python.org>]
 On Behalf Of Geoffrey Bantle
Sent: Saturday, February 18, 2012 6:07 PM
To: ironpython-users@python.org<mailto:ironpython-users@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
gban...@gmail.com<mailto:gban...@gmail.com>
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to