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

Dino Viehland dinov at microsoft.com
Mon Apr 26 19:33:58 EDT 2010

Ben wrote:
> 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
> 2.4.4~svn151842-1gezakovacs~karmic1)
> 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)
> System.Reflection.MonoMethod:InternalInvoke
> (object,object[],System.Exception&)
>   at System.Reflection.MonoMethod.Invoke (System.Object obj,
> BindingFlags invokeAttr, System.Reflection.Binder binder,
> System.Object[] parameters, System.Globalization.CultureInfo culture)
> [0x00000]

Does this work if you compile on Linux and run on Linux?

I think the issue here is that we're compiling in the path separator on
Windows and then using the Linux path separator to extract out the 
module name.  We should probably always use forward slashes both when
writing out the module name and reading it back in.  I think that shouldn't
give us any problems.

More information about the Mono-list mailing list