Skip to content

pyc.py: generates exes which fail on using std python libs #132

@slide

Description

@slide

From @ironpythonbot on December 9, 2014 17:59

I tried to generate a standalone exe for a tool I have (3 modules) but it
bombs out at startup with:

Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No module
named os  
at DLRCachedCode.__main__$1(CodeContext $globalContext, FunctionCode
$functionCode)  
at IronPython.Compiler.OnDiskScriptCode.Run()  
at IronPython.Runtime.PythonContext.InitializeModule(String fileName,
ModuleContext moduleContext, ScriptCode scriptCode, ModuleOptions options)  
at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, String
fullName)  
at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame
frame)  
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)  
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0,
T1 arg1, T2 arg2, T3 arg3)  

I can reproduce with this simple foo.py module

#  foo.py

import os  
print "Hello"  
print "OS:",os.name  
print "Bye"  

#  end foo.py

which I compile with the following:

ipy -m pyc /standalone /main:foo.py /target:exe /out:foo

or

ipy -m pyc /main:foo.py /target:exe /out:foo2

Starting either foo.exe or foo2.exe fails with above error.

If I remove the import os and the line that uses on.name, I get an executable
that works...

Work Item Details

Original CodePlex Issue: Issue 32420
Status: Proposed
Reason Closed: Unassigned
Assigned to: slide_o_mix
Reported on: Mar 15, 2012 at 8:48 PM
Reported by: ddewaleffe
Updated on: Feb 22, 2013 at 2:09 AM
Updated by: ddewaleffe

Plaintext Attachments

CodePlex Issue #32420 Plain Text Attachments

Binary Attachments

pyc-ddewaleffe.zippyc-ddewaleffe-v2.zip

Copied from original issue: IronLanguages/main#997

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions