IronPython: EXE, das mit pyc.py kompiliert wurde, kann das Modul "os" nicht importieren

Habe ich eine einfache IronPython-Skript:

# Foo.py
import os

def main():
    print( "Hello" )

if "__main__" == __name__:
    main()

Es gut läuft und druckt Hallo wenn ich ihn mit IronPython als:

ipy Foo.py

Den Anweisungen Folgen, die in IronPython - wie exe kompilierenden ich kompiliert habe, das IronPython-Skript in eine EXE-Datei verwenden:

ipy pyc.py /main:Foo.py /target:exe

Ausführung Foo.exe gibt diese Fehlermeldung:

Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No module named os
   at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value)
   at DLRCachedCode.__main__$1(CodeContext $globalContext, FunctionCode $functionCode)
   at IronPython.Compiler.OnDiskScriptCode.Run()
   at IronPython.Compiler.OnDiskScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.InitializeModule(String fileName, ModuleContext moduleContext, ScriptCode scriptC
ode, ModuleOptions options)

Warum nicht das Modul "os" gefunden werden? Wie kann ich dieses Problem beheben, so kann ich eine funktionierende EXE?

(Beachten Sie, dass dies Verschieden von der Frage IronPython kann nicht importieren Sie das Modul os da das Skript funktioniert, wenn ich mit ipy.exe.)

InformationsquelleAutor der Frage Ashwin Nanjappa | 2011-06-01

Schreibe einen Kommentar