[IronPython] Python Command Line Compiler issues and questions
Dino Viehland
dinov at exchange.microsoft.com
Thu Jan 4 23:23:35 CET 2007
That works for me, I did it a little differently, but basically the same:
a:
import b
print 'hello'
b.foo()
b:
print 'goodbye'
def foo(): print 42
>ipy pyc.py /target:exe /main:a.py b.py
...
>a.exe
goodbye
hello
42
That works even if a.py and b.py aren't available after the compilation. What I thought wasn't working w/ pyc, but maybe was working w/ the simpler one, was the more complex case involving packages:
a:
import b.c
b.c.d()
c\
__init__.py:
d.py:
def d(): print 42
I can compile a.py w/ c\__init__.py and get something that "works" but it works only if I run it from the directory that contains c. It works because we just re-compile d.py on the fly. But removing c causes it to break again. Unfortunately I don't think the compiler understands packages right now and it's something we should add to the to-do list.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Patrick O'Brien
Sent: Thursday, January 04, 2007 2:14 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Python Command Line Compiler issues and questions
On 1/4/07, Dino Viehland <dinov at exchange.microsoft.com<mailto:dinov at exchange.microsoft.com>> wrote:
I am surprised one is behaving different. It works for me w/ pyc if I keep the package directory on the path, but if I don't then it breaks.
I'm curious did you include all of your individual package files, or just __init__.py? And were the packages on your path?
In my case I didn't have a package, merely an extra Python module, imported from the local directory. Something like the following:
main.py
======
import extra
print extra.foo()
extra.py
======
def foo():
return "Hello"
Does that make sense? Can you duplicate the problem? If not, I can create a real example for you.
--
Patrick K. O'Brien
Orbtech http://www.orbtech.com
Schevo http://www.schevo.org
Louie http://www.pylouie.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070104/5846037a/attachment.html>
More information about the Ironpython-users
mailing list