Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7645093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:51:08+00:00 2026-05-31T09:51:08+00:00

I am trying to use IronPython with monodroid (using a Android 4 phone) so

  • 0

I am trying to use IronPython with monodroid (using a Android 4 phone) so that I can execute a python script inside my project. I’m basing my code off of the example here: Instantiating a python class in C#

I have included the dlls in the Android platform directory (using IronPython-2.7.2rc1) and have a python script in the project directory (right now a test script called Calculator from that example linked)

The following is my C# code:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using IronPython;
using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting; 
namespace PythonTest
{
    [Activity (Label = "PythonTest", MainLauncher = true)]
    public class Activity1 : Activity
    {
        int count = 1;
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            ScriptEngine engine = Python.CreateEngine();
            ScriptSource source = engine.CreateScriptSourceFromFile("Calculator.py");
            ScriptScope scope = engine.CreateScope();
            ObjectOperations op = engine.Operations;
            source.Execute(scope); // class object created
            object klaz = scope.GetVariable("Calculator"); // get the class object
            object instance = op.Invoke(klaz); // create the instance
            object method = op.GetMember(instance, "add"); // get a method
            int result = (int)op.Invoke(method, 4, 5); // call method and get result (9)


            var aLabel = new TextView (this);
            //aLabel.Text = result.ToString();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format ("{0} clicks!", count++); };
        }
    }
}

It builds with no errors. When I try to run this on my phone, I get these errors and the program crashes (phone goes back to home screen)

I/monodroid-gc( 2110): environment supports jni NewWeakGlobalRef

I/MonoDroid( 2110): UNHANDLED EXCEPTION: System.NotImplementedException: The requested feature is not implemented.

I/MonoDroid( 2110): at Microsoft.Scripting.PlatformAdaptationLayer.OpenInputFileStream (string) <0x0001c>

I/MonoDroid( 2110): at Microsoft.Scripting.FileStreamContentProvider/PALHolder.GetStream (string) <0x0002b>

I/MonoDroid( 2110): at Microsoft.Scripting.FileStreamContentProvider.GetStream () <0x00023>

I/MonoDroid( 2110): at Microsoft.Scripting.Runtime.LanguageBoundTextContentProvider.GetReader () <0x00027>

I/MonoDroid( 2110): at Microsoft.Scripting.SourceUnit.GetReader () <0x00023>

I/MonoDroid( 2110): at IronPython.Compiler.Parser.CreateParserWorker (Microsoft.Scripting.Runtime.CompilerContext,IronPython.PythonOptions,bool) <0x000bf>

I/MonoDroid( 2110): at IronPython.Compiler.Parser.CreateParser (Microsoft.Scripting.Runtime.CompilerContext,IronPython.PythonOptions) <0x0001f>

I/MonoDroid( 2110): at IronPython.Runtime.PythonContext.ParseAndBindAst (Microsoft.Scripting.Runtime.CompilerContext) <0x0005f>

I/MonoDroid( 2110): at IronPython.Runtime.PythonContext.CompilePythonCode (Microsoft.Scripting.SourceUnit,Microsoft.Scripting.CompilerOptions,Microsoft.Scripting.ErrorSink) <0x0008f>

I/MonoDroid( 2110): at IronPython.Runtime.PythonContext.CompileSourceCode (Microsoft.Scripting.SourceUnit,Microsoft.Scripting.CompilerOptions,Microsoft.Scripting.ErrorSink) <0x0002b>

I/MonoDroid( 2110): at Microsoft.Scripting.SourceUnit.Compile (Microsoft.Scripting.CompilerOptions,Microsoft.Scripting.ErrorSink) <0x0005b>

I/MonoDroid( 2110): at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope,Microsoft.Scripting.ErrorSink) <0x00057>

I/MonoDroid( 2110): at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope) <0x00027>

I/MonoDroid( 2110): at Microsoft.Scripting.Hosting.ScriptSource.Execute (Microsoft.Scripting.Hosting.ScriptScope) <0x00043>

I/MonoDroid( 2110): at PythonTest.Activity1.OnCreate (Android.OS.Bundle) <0x000c3>

I/MonoDroid( 2110): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x00057>

I/MonoDroid( 2110): at (wrapper dynamic-method) object.5a9608db-a03f-4bd2-831d-6cb21e250354 (intptr,intptr,intptr) <0x00033>

E/mono    ( 2110): 

E/mono    ( 2110): Unhandled Exception: System.NotImplementedException: The requested feature is not implemented.

E/mono    ( 2110):   at Microsoft.Scripting.PlatformAdaptationLayer.OpenInputFileStream (System.String path) [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at Microsoft.Scripting.FileStreamContentProvider+PALHolder.GetStream (System.String path) [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at Microsoft.Scripting.FileStreamContentProvider.GetStream () [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at Microsoft.Scripting.Runtime.LanguageBoundTextContentProvider.GetReader () [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at Microsoft.Scripting.SourceUnit.GetReader () [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at IronPython.Compiler.Parser.CreateParserWorker (Microsoft.Scripting.Runtime.CompilerContext context, IronPython.PythonOptions options, Boolean verbatim) [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at IronPython.Compiler.Parser.CreateParser (Microsoft.Scripting.Runtime.CompilerContext context, IronPython.PythonOptions options) [0x00000] in <filename unknown>:0 

E/mono    ( 2110):   at IronPython.Ru

Does anyone know how to fix this? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:51:09+00:00Added an answer on May 31, 2026 at 9:51 am

    Looks like a straight-up bug (the PAL for android is incomplete), and it looks like you already opened an issue (thank you!).

    IronPython’s support is very early, so the more people testing it and reporting issues, the better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use a python package from IronPython. Everything works fine if I
I'm trying to use IronPython as an intermediary between a C# GUI and some
I'm trying to use IronPython to export a series of Excel Worksheets to delimited
I am trying to use the dynamic language run time / IronPython to simply
I'm trying to take a python class (in IronPython), apply it to some data
I'm calling an IronPython script and passing it a .NET object that contains a
I'm trying use make a div's background transparent using a mixture of CSS3 rgba()
I am trying to use a COM object by IronPython in a browser. I
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.