[Mono-list] IronPython source file must be present to run on Linux

Ben Rousch brousch at gmail.com
Mon Apr 26 15:27:31 EDT 2010

I have a simple IronPython 2.6 Hello World console program created and
compiled with SharpDevelop on Windows. You can download the program
here: http://dl.dropbox.com/u/101667/HelloWorld.zip

When I run the HelloWorld executable on Windows, it works correctly.
When I run the same thing on Linux, it fails and says it can't find
the HelloWorld module. If I put the HelloWorld.py script from which
the executable was compiled into the directory with the executable,
the script runs fine on Linux.

I think SharpDevelop uses the standard pyc.exe to compile IronPython,
but just in case I compiled it myself and got the same results.

I also tried running the program under Mono 2.4 on Windows and it ran
correctly without HelloWorld.py

I can work around this problem by including the Python source, but I
don't think that is the correct behavior.

OS: Ubuntu 9.10
Mono Version: Mono JIT compiler version 2.4.4 (Debian

Full error message when HelloWorld.py is not present:
Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No
module named HelloWorld
  at IronPython.Modules.Builtin.__import__
(IronPython.Runtime.CodeContext context, System.String name,
System.Object globals, System.Object locals, System.Object fromlist,
Int32 level) [0x00000]
  at (wrapper managed-to-native)
  at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)

  Ben Rousch
  brousch at gmail.com

More information about the Mono-list mailing list