<br>Will try your suggestion and I will also spend a bit of time to construct the list of needed dependencies so that pyc can do a better job...<br> <br>Will also file an issue later on today.<br><br>D.<br clear="all">############################<br>
# Dominique de Waleffe<br># ddewaleffe -at- gmail -dot- com<br># domi -at- dewaleffe -dot- org<br>############################<br>
<br><br><div class="gmail_quote">On Thu, Mar 15, 2012 at 3:24 PM, Slide <span dir="ltr"><<a href="mailto:slide.o.mix@gmail.com">slide.o.mix@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p>There is no need to use the CPython stdlib, the IP installer comes with a stdlib that has some mods for it to work better. Check the Lib directory where you installed IP. Also, you can set IRONPYTHONPATH to have it find things.</p>
<div class="gmail_quote"><div><div class="h5">On Mar 15, 2012 5:49 AM, <<a href="mailto:mchalkley@mail.com" target="_blank">mchalkley@mail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<div>
<span style="font-family:'Courier New';font-size:9pt">Thursday, March 15, 2012, 3:49:36 AM, you wrote:<br>
<br>
</span><table>
<tbody><tr>
<td width="2" bgcolor="#0000ff"><br>
</td>
<td width="1029"><span style="font-family:'courier new';font-size:9pt">I am not sure whether this should be expected to work or not, nor if I am using this correctly...<br>
<br>
I tried to generate a standalone exe for a tool I have (3 modules) but it bombs out at startup with:<br>
<br>
Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No module named os<br>
at DLRCachedCode.__main__$1(CodeContext $globalContext, FunctionCode $functionCode)<br>
at IronPython.Compiler.OnDiskScriptCode.Run()<br>
at IronPython.Runtime.PythonContext.InitializeModule(String fileName, ModuleContext moduleContext, ScriptCode scriptCode, ModuleOptions options)<br>
at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, String fullName)<br>
at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)<br>
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)<br>
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)<br>
<br>
I can reproduce with this simple foo.py module<br>
<br>
# foo.py<br>
import os<br>
print "Hello"<br>
print "OS:",</span><a style="font-family:'courier new';font-size:9pt" href="http://os.name" target="_blank">os.name</a><br>
<span style="font-family:'courier new';font-size:9pt">print "Bye"<br>
#end foo.py<br>
<br>
which I compile with the following:<br>
<br>
ipy -m pyc /standalone /main:foo.py /target:exe /out:foo<br>
or<br>
ipy -m pyc /main:foo.py /target:exe /out:foo2<br>
<br>
Starting either foo.exe or foo2.exe fails with above error.<br>
<br>
If I remove the import os and the line that uses </span><a style="font-family:'courier new';font-size:9pt" href="http://on.name" target="_blank">on.name</a><span style="font-family:'courier new';font-size:9pt">, I get an executable that works...<br>
<br>
Is this a bug or a misunderstanding in what I expect to work?<br>
If so what are the correct steps?<br>
<br>
Thanks for your help<br>
<br>
D.<br>
<br>
############################<br>
# Dominique de Waleffe<br>
# ddewaleffe -at- gmail -dot- com<br>
# domi -at- dewaleffe -dot- org<br>
############################</span></td>
</tr>
</tbody></table>
<br><br>
<span style="font-family:'Courier New';font-size:9pt">I'll try to help, since I got a lot of help with something similar recently. Congratulations - you got further before asking for help than I did...<br>
<br>
It seems that you don't have the path to your CPython directory in your environment variables. I thought installing IronPython automatically set those variables, but maybe CPython got moved or something? In any case, you can add it like this:<br>
<br>
import sys<br>
sys.path.append(r"c:\python24\lib")<br>
<br>
And if you plan on distributing the exe to another machine that doesn't have CPython installed, you need to put a copy of all the modules your script needs in a zip file located in the same directory as the exe and put the line <br>
<br>
sys.path.append('zipfile.zip')<br>
<br>
in your script before importing those modules...<br>
<br>
Mark<br>
</span></div>
<br></div></div><div class="im">_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org" target="_blank">Ironpython-users@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
<br></div></blockquote></div>
</blockquote></div><br>