[IronPython] Problems running simple executable compiled with the pyc.py tool

Dino Viehland dinov at microsoft.com
Fri May 6 19:12:33 CEST 2011

When running are Program.dll and Program.exe in the same location?  The reason I ask is that Program.exe will change the CWD to where it is currently located and then it'll attempt to load Program.dll from that directory.  That's the only thing that immediately comes to mind as having potential to break this for you.

Also, did you install IronPython via the MSI or by downloading the binary zip file?

I just tried this and it all seemed to work for me (I'm installed via the MSI so we can pick up the IronPython DLLs from the GAC):

C:\Users\dinov > type test.py
C:\Users\dinov > "C:\Program Files (x86)\IronPython 2.7\ipy.exe" "C:\Program Files (x86)\IronPython 2.7\Tools\Scripts\pyc.py" /target:exe /out:test /main:test.py test.py
Input Files:
Saved to test

C:\Users\dinov > .\test.exe

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of iiyo cc
Sent: Friday, May 06, 2011 9:57 AM
To: users at lists.ironpython.com
Subject: [IronPython] Problems running simple executable compiled with the pyc.py tool


I keep coming up with the same problem when trying to run a compiled executable from the pyc.py tool. The error I'm getting is as follows:
Unhandled Exception: System.IO.FileNotFoundException: The system cannon find the file specified. (Exception from HRESULT: 0x80070002)
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at PythonMain.Main()

My file is a simple Hello, World! program saved as Program.py with the following contents:
print 'Hello, World!'

I use the following command line to compile:
C:\IronPy\ipy C:\IronPy\Tools\Scripts\pyc.py Program.py /out:Program /main:Program.py /target:exe

Note: I'm using the latest 2.7 release through the IronPython installer on a Windows 7 64bit system, the executables are built (Program.dll and Program.exe) successfully, yet won't run even when sitting in the same directory as all the dlls one can find in the IronPython distribution. I've also tried targeting the x64 platform specifically with pyc, but to no avail. Here's what my working directory looks like when the project is built:
IronPython.dll, IronPython.Modules.dll, IronPython.Wpf.dll, Microsoft.Dynamic.dll, Microsoft.Scripting.dll, Microsoft.Scripting.Metadata.dll, Program.dll, Program.exe, Program.py

Hopefully someone knows what's going on, or if i'm doing something wrong.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110506/7740eaf3/attachment.html>

More information about the Ironpython-users mailing list