<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Fixedsys;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Sorry, I think that should have been:<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> gen.Emit(OpCodes.Pop)<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">One way to know for sure if the DLL includes the pre-compiled std lib would be to run ildasm or reflector on it. There’ll be a class called DLRCachedCode
and in it there will (or won’t) be a method called “os$#” where # is some number. Opening that method you’ll see an attribute such as:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.5pt;
font-family:Fixedsys"> .custom instance void [Microsoft.Dynamic]Microsoft.Scripting.Runtime.CachedOptimizedCodeAttribute::.ctor(string[]) = ( 01 00 07 00 00 00 08 5F 5F 6E 61
6D 65 5F 5F 08 // .......__name__.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.5pt;
font-family:Fixedsys"> 5F 5F 66 69 6C 65 5F 5F 07 5F 5F
64 6F 63 5F 5F // __file__.__doc__<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.5pt;
font-family:Fixedsys"> 08 5F 5F 70 61 74 68 5F 5F 0C 5F
5F 62 75 69 6C // .__path__.__buil<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.5pt;
font-family:Fixedsys"> 74 69 6E 73 5F 5F 0B 5F 5F 70 61
63 6B 61 67 65 // tins__.__package<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.5pt;
font-family:Fixedsys"> 5F 5F 02 6F 73 00 00 )
// __.os..<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.5pt;
font-family:Fixedsys"> // Code size 223 (0xdf)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">The important part here is that the method name is os$ and the attribute is persent - the contents of the attribute here are just things which are referred
to from the code so that part doesn’t really matter.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">I’m absolutely certain though that there was never a feature to automatically figure out which parts of the std lib should be included though. And if I take
a simple file lke:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">import os<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">print os.__path__<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Compile it like so:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">"C:\Program Files\IronPython 2.6\ipy.exe" "C:\Program Files\IronPython 2.6\Tools\Scripts\pyc.py" test.py /target:exe /main:test.py<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">And run it we can’t find os.py:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">C:\Users\Dino>.\test<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No module named os<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"> at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"> at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`6.Call5(CallSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2,
T3 arg3, T4 arg4)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"> at System.Dynamic.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6
arg6)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"> at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"> at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly precompiled, String main, String[] references)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"> at PythonMain.Main()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com]
<b>On Behalf Of </b>Ken MacDonald<br>
<b>Sent:</b> Friday, October 08, 2010 7:09 AM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] change in standard library behavior for compiled .exe/.dll???<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">HI Dino,<br>
Tried your change, it came up with an error on the statement below:<br>
TypeError: EmitCall() takes exactly 3 arguments (1 given)<br>
<br>
Not sure what the other args should be... it did seem to create a new myapp.dll despite the error, but it was the same size (1.2 MB) as the new version 2.7 dll, and was still missing std lib components. I'm not sure that this is valid, considering the error
in the EmitCall() noted above.<br>
<br>
I did do a primitive analysis of the app to find out which std lib components it references; found roughly 25 of them, and as a test, incorporated the largest 10 or so explicitly in the compile; the size of the resulting dll was about 2.1 MB (much closer to
the 2.6 dll version size, 2.9 MB), and was able to run it successfullyagainst a stripped-down std lib where I had removed those 10 files. It seems fairly clear to me that the 2.6 version dll did include the components it required from the std lib.<br>
<br>
Starting to look really promising; not quite there yet!<br>
Ken<o:p></o:p></p>
<div>
<p class="MsoNormal">On Thu, Oct 7, 2010 at 8:06 PM, Dino Viehland <<a href="mailto:dinov@microsoft.com">dinov@microsoft.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">I think these changes came about due to this thread:
<a href="http://www.mail-archive.com/users@lists.ironpython.com/msg08794.html" target="_blank">
http://www.mail-archive.com/users@lists.ironpython.com/msg08794.html</a> where there was an issue w/ relative paths and starting an app.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">And you may have found the root of the problem but you didn’t quote the code change. There’s these additional lines:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> gen.EmitCall(OpCodes.Call, clr.GetClrType(System.IO.DirectoryInfo).GetMethod("get_FullName"), ())<br>
gen.EmitCall(OpCodes.Call, clr.GetClrType(System.Environment).GetMethod("set_CurrentDirectory"), ())<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">which might be causing the problem as we change the CWD before we really kick things off. Does replacing the set_CurrentDirectory line
in pyc.py with:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> gen.EmitCall(OpCodes.Pop)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">possibly fix things for you (that’ll make that a NOP but should leave all the other changes in place)?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-left:solid windowtext 1.5pt;padding:0in 0in 0in 4.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color blue">
<div>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>]
<b>On Behalf Of </b>Ken MacDonald<br>
<b>Sent:</b> Wednesday, October 06, 2010 1:26 PM<br>
<b>To:</b> Discussion of IronPython<o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt"><br>
<b>Subject:</b> Re: [IronPython] change in standard library behavior for compiled .exe/.dll???<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">As an FYI, the following change was made from the IP 2.6 version of pyc.py to the IP 2.7 version (newer version shown first):<br>
<br>
< # get the ScriptCode assembly...<br>
< gen.EmitCall(OpCodes.Call, clr.GetClrType(Assembly).GetMethod("GetEntryAssembly"), ())<br>
< gen.EmitCall(OpCodes.Callvirt, clr.GetClrType(Assembly).GetMethod("get_Location"), ())<br>
---<br>
> # get the ScriptCode assembly...<br>
> gen.EmitCall(OpCodes.Call, clr.GetClrType(Assembly).GetMethod("GetEntryAssembly"), ());<br>
> gen.EmitCall(OpCodes.Call, clr.GetClrType(Assembly).GetMethod("get_CodeBase"), ());<br>
> gen.Emit(OpCodes.Newobj, clr.GetClrType(System.Uri).GetConstructor( (str, ) ));<br>
> gen.EmitCall(OpCodes.Call, clr.GetClrType(System.Uri).GetMethod("get_LocalPath"), ());<br>
<br>
Don't know what these things do at this point, but wondering if the changes have to do with compiling the entire code tree into the application .DLL???<br>
Ken<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Wed, Oct 6, 2010 at 4:04 PM, Ken MacDonald <<a href="mailto:drken567@gmail.com" target="_blank">drken567@gmail.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">Hi Dino,<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Wed, Oct 6, 2010 at 2:57 PM, Dino Viehland <<a href="mailto:dinov@microsoft.com" target="_blank">dinov@microsoft.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">How are you distributing your app? I’m assuming you’re going to have something like:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">MyApp\</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">MyApp.exe</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">MyApp.dll</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">IronPython.dll</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">IronPython.Modules.DLL</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">…</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">This is exactly how we have been distributing our app up to IP 2.6 with .NET 3.5. We also have another DLL with our resources in it; XAML, icons, image files, but no code per se.
We have been distributing it this way to customer systems that do NOT have IronPython installed, or any sign of the std. library, or "os.py" specifically, and it's been working really, really well.<br>
<br>
We're trying to understand what changed moving to IP 2.7 and .NET 4.0 that we should have to care about distributing the std. library now. The way it was before was quite simple and robust; deliver a small handful of files and it just worked, very easy to keep
track of. Now instead of distributing 5 files, we suddenly need to distribute 500??? We've figured out that it certainly COULD work as described below, but it seems like a giant step backwards on several fronts, including the potential for folks to maliciously
or accidentally tamper with the std lib. sources and affect the functioning of our app. So, how do we get back to the old/better functionality?<br>
<br>
On a <i>slightly </i>related note, our app imports some package directories in addition, e.g. "import ctypes". When python encounters a directory import, it looks for __init__.py in the directory, and derives the package import directions from there, as I understand
it. However, I can't specify the "ctypes" directory as an argument to the pyc.py compile app; just causes it to croak. If I explicitly specified paths like "lib\ctypes\__init__.py" and the other files in the ctypes subdirectory, it seems like "import ctypes"
would have no clue that the __init__.py that was compiled in had anything to do with the "ctypes" package, as the path names are presumably irrelevant to the compiler as long as they specify a python file. I'm considering mod'ing pyc.py to be able to incorporate
a list of std lib modules to compile in: simple enough for the standalone files like "os.py", but the compile modules don't seem to be able to grok what to do with a package subdirectory.<br>
<span style="color:#888888">Ken<br>
</span><o:p></o:p></p>
</div>
<div>
<div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204)">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">You should be able to also distribute the standard library and just drop it into a Lib directory next to IronPython.dll:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">MyApp\</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">MyApp.exe</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">MyApp.dll</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">IronPython.dll</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">IronPython.Modules.DLL</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:.5in">
<span style="font-size:11.0pt;color:#1F497D">…</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> Lib\</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> os.py</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D">That lib dir should be on sys.path at startup and so it should be available for importing.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-left:solid windowtext 1.5pt;padding:0in 0in 0in 4.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color blue">
<div>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>]
<b>On Behalf Of </b>Ken MacDonald<br>
<b>Sent:</b> Wednesday, October 06, 2010 11:42 AM<br>
<b>To:</b> Michael Foord</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:10.0pt"><br>
<b>Cc:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] change in standard library behavior for compiled .exe/.dll???</span><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">Hi Michael,<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br>
I started out on implementing this, but I am importing maybe a dozen of the std. library modules, which then import others, and so on. It appears that eventually, most of the std modules would have to be imported explicitly (perhaps 400 or so files) which might
make for a somewhat cumbersome command line, incidentally also about 20K characters too long :-). I'm hoping to find a way to get this to work as well as it did under IP 2.5 / .NET 3.5.<br>
<br>
Noah: what kind of problems are YOU having with pyc.py under 4.0? Maybe one of us can suggest something if we have an understanding of what you're trying to do.<br>
Ken<o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Wed, Oct 6, 2010 at 7:08 AM, Michael Foord <<a href="mailto:michael@voidspace.org.uk" target="_blank">michael@voidspace.org.uk</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On 05/10/2010 22:27, Ken MacDonald wrote:
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I've been looking at the .exe's we built - using pyc.py - with IP 2.5/.Net 3.5 and IP2.7 / .NET 4.0. In the 2.7 .exe, it appears that the imports (like "os") are not being built
into the .exe/.dll, but instead are required to be imported in source form, e.g. "os.py" must be somewhere on sys.path. In the IP 2.5 .exe's we had been building, they would run fine on machines without the IP standard library installed at all, in other words,
with "os.py" not present on the machine at all. We did notice that the .exe in question went from being 2.9 MB in it's IP 2.5 incarnation, down to 1.2 MB in the IP 2.7 version, and the newer version requires that the source code for the IP standard library
be on the path. Is this a deliberate change in behavior? We never had to package the standard library source when we sent out .exe's to customers before<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hmmm... I'm pretty sure I always had to explicitly compile and bundle the standard library with previous versions of Python. Odd. Anyway, the simple solution is to ensure that you
add any standard library modules you use to the set you compile and ship.<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><br>
<br>
All the best,<br>
<br>
Michael Foord<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br>
>"os" is not an assembly but a Python module from the standard library. You need to ensure >that the Python standard library (or the parts that you use and their dependencies) is on the >path.<o:p></o:p></p>
<div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204)">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><br>
All the best,<br>
<br>
Michael Foord<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">and how do I ensure it gets found from my .exe - is there a specific env. variable, or the Windows %PATH% e.v., or something I haven't AddReference'd to????<br>
Thanks,<br>
Ken<o:p></o:p></p>
</div>
<pre> <o:p></o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<div>
<pre><a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><o:p></o:p></pre>
<pre><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></pre>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><o:p> </o:p></p>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a><o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre>READ CAREFULLY. By accepting and reading this email you agree,<o:p></o:p></pre>
<pre>on behalf of your employer, to release me from all obligations<o:p></o:p></pre>
<pre>and waivers arising from any and all NON-NEGOTIATED agreements,<o:p></o:p></pre>
<pre>licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,<o:p></o:p></pre>
<pre>confidentiality, non-disclosure, non-compete and acceptable use<o:p></o:p></pre>
<pre>policies (”BOGUS AGREEMENTS”) that I have entered into with your<o:p></o:p></pre>
<pre>employer, its partners, licensors, agents and assigns, in<o:p></o:p></pre>
<pre>perpetuity, without prejudice to my ongoing rights and privileges.<o:p></o:p></pre>
<pre>You further represent that you have the authority to release me<o:p></o:p></pre>
<pre>from any BOGUS AGREEMENTS on behalf of your employer.<o:p></o:p></pre>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><o:p> </o:p></p>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a><o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre>READ CAREFULLY. By accepting and reading this email you agree,<o:p></o:p></pre>
<pre>on behalf of your employer, to release me from all obligations<o:p></o:p></pre>
<pre>and waivers arising from any and all NON-NEGOTIATED agreements,<o:p></o:p></pre>
<pre>licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,<o:p></o:p></pre>
<pre>confidentiality, non-disclosure, non-compete and acceptable use<o:p></o:p></pre>
<pre>policies (”BOGUS AGREEMENTS”) that I have entered into with your<o:p></o:p></pre>
<pre>employer, its partners, licensors, agents and assigns, in<o:p></o:p></pre>
<pre>perpetuity, without prejudice to my ongoing rights and privileges.<o:p></o:p></pre>
<pre>You further represent that you have the authority to release me<o:p></o:p></pre>
<pre>from any BOGUS AGREEMENTS on behalf of your employer.<o:p></o:p></pre>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>