Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, it successfully compiled an ran.</p> <p>Reason being was I had uncaught exceptions in my source.</p> <p>For some reason the lines</p> <pre><code>import traceback import inspect </code></pre> <p>Caused the IronPython Compiler to throw an "ImportError", but <code>ipy.exe Program.py</code> runs fine.</p> <p>Also the biggest bug was a "ThreadStateException" error (Thanks Migol for the tip) when I tried to init System.Windows.Forms.WebBrowser()</p> <p>Googled it, and found out that:</p> <blockquote> <p>Oh, the problem is that pyc.py doesn't mark the thread as STA. </p> </blockquote> <p>And the fix is:</p> <blockquote> <p>You can add this line to pyc.py right after mainMethod = ...</p> </blockquote> <pre><code>mainMethod.SetCustomAttribute(clr.GetClrType(System.STAThreadAttribute).GetConstructor(()), System.Array[System.Byte](())) </code></pre> <p>source: <a href="http://www.mail-archive.com/users@lists.ironpython.com/msg07725.html" rel="nofollow noreferrer">http://www.mail-archive.com/users@lists.ironpython.com/msg07725.html</a></p> <p>Sweet. :)</p> <p>Works, compiles and runs, Turns out the only DLLs you need for "IronPython 2.6 for .NET 4.0" are</p> <pre><code>IronPython.dll IronPython.Modules.dll Microsoft.Scripting.dll Microsoft.Dynamic.dll Mycrosoft.Scripting.Debugging.dll </code></pre> <p>(Just copy &amp; paste these from your <code>C:\Program Files\IronPython 2.6 for .NET 4.0\</code> directory or wherever you installed IronPython)</p> <p>Also the exact command I used to compile my script is:</p> <pre><code>D:\IronTestCompile\project_3&gt;"c:\Program Files\IronPython 2.6 for .NET 4.0\ipy.exe" pyc.py Form1.py utils.py project.py /out:MyApp /main:program.py /target:winexe </code></pre> <p>follow this guide <a href="http://www.dbaportal.eu/?q=node/142" rel="nofollow noreferrer">IronPython - how to compile exe</a></p> <p>turns out you only have to include the files that you import in your <code>main:</code> file (mine was program.py. <code>PYC.py</code> takes care of importing the rest. :)</p> <p>edit: Actually you would add all .py you want to compile to the pyc.py command. If you don't compile it (It'll be combined into MyApp.dll) you can keep the .py in the App's directory and it'll still run, but then this exposes it's source.</p> <p>Hope this helps somebody, took me one whole evening to figure it out. Cheers. =)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload