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 1104003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:25:26+00:00 2026-05-17T01:25:26+00:00

I have one question, I have such code this._engine = Python.CreateEngine(); ScriptSource source =

  • 0

I have one question, I have such code

this._engine = Python.CreateEngine();
ScriptSource source = this._engine.CreateScriptSourceFromString(script.SourceCode);
ScriptScope scope = this._engine.CreateScope();
ObjectOperations operations = this._engine.Operations;
source.Execute(scope);

And I am trying to execute IronPython code from tutorial:

from System.Collections import BitArray
ba = BitArray(5)
ba.Set(0, True) # call the Set method
print ba[0]

So it executes correctly, but I can’t understand if i have print ba[0] why it doesn’t output this value to the console? By the way, could you advice some good articles about using IronPython for applications scripting?

And another question is if I have some Python class and I do not know the name of this class, because the client can define it manually, is it possible to create an instance of this class? For example

class SomeClass(object):
    def some(self, a, b):
        return <something>

Now I’m trying to use this code

dynamic SomeClass = scope.GetVariable("SomeClass");
dynamic something = SomeClass();
something.some(x,y);

Should I iterate through ScriptScope.GetItems() collection and search for PythonType objects?

  • 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-17T01:25:27+00:00Added an answer on May 17, 2026 at 1:25 am

    I think you just need to call:

    this._engine.Runtime.IO.RedirectToConsole();
    

    Otherwise have a look here for a similar question about redirecting.

    About python class instantiation in C#, your code seems to be ok, as shown in this question (look at the 3rd answer)

    EDIT:

    Sorry I didn’t read your question with enough attention…

    Anyway, to look for available classes in Python, just do as you said,

    i.e. something like:

    var availDynClasses = items.Where(x => x.Value is IronPython.Runtime.Types.PythonType);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement this view But I have one question: The text which
Question #1: if I have a C++ code like this #include <iostream> using namesapce
i have one question about jquery ajax().. I created a table grid and there
I have one question; In my ASP.NET MVC web application have to do certain
I have one question about searching and counting files in directories and subdirectories. I
I have one question about Yii framework, and I need your help. Basicly, I
I have one question, I was trying to find more information on the internet
I have one question, in my company we are using Toxicity report to measure
I have one question. I am using Apache CXF framework to generate model classes
I am learning JPA and have one question: In which situations we need more

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.