[Android] PlatformNotSupportedException when importing non-builtin modules
Prerequisites
The issue tracker is used to report bugs and request new features, NOT to ask questions.
Questions should be posted in Discussions or to the users mailing list which can be accessed at https://ironpython.groups.io/g/users.
- [✓] Are you running the latest version?
- [✓] Are you reporting to the correct repository?
- [✓] Did you perform a cursory search?
Description
PlatformNotSupportedException prevents any module from being imported.
Steps to Reproduce
- Target Android .Net 6 (MAUI)
var aPythonEngine = Python.CreateEngine();aPythonEngine.Execute("import foobar");
Expected behavior: No error if "foobar" is in the search path and valid; "No module named 'foobar'" if it does not exist
Actual behavior: Throwing System.PlatformNotSupportedException: Operation is not supported on this platform. at IronPython.Modules.PythonNT.stat(String path, IDictionary2 kwargs) at ...
Workaround: Hooking OperatingSystem.IsOSPlatform(string) and let it return true when the argument is "Linux", then the issue magically disappears.
Everything else seem to work fine with android (As long as you redirected your stdin).
Versions
3.4.0
The breaking change as a cause of this issue: dotnet/runtime#51052