Все вопросы: [ironpython]

195 вопросов

похожие теги: ironpython-studio
4
голосов
2ответов
2461 просмотров

Script arguments and Embedded IronPython

I have an embedded scripting engine in my C# application that uses IronPython 2. I create the Python runtime and add a few classes to the global namespace so that the script can import them as modules. However, one (pretty basic) thing I can't figure out is how to send script arguments. I realiz...

3
голосов
3ответов
1307 просмотров

How to use tabs-as-spaces in Python in Visual Studio 2008?

I have some IronPython scripts that are embedded in a C# project, and it would be convenient to be able to edit them in the VS editor. VS evidently knows about Python because it provides syntax coloring for it. Unfortunately however the editor uses tab characters for indentation, whereas I want s...

0
голосов
1ответов
797 просмотров

SQL DataReader in IronPython

Please help me to read just one record from MS SQL table. I tried to do that in the next way (IronPython 2.6 RC1): cmd = SqlCommand("SELECT * FROM myTable", cn) dr = cmd.ExecuteReader() After that I have ALL the table in dr! But need only ONE record (more precise: read table records one by ...

3
голосов
1ответов
1026 просмотров

Issue with using a .net class in ironpython

If I have a .Net class that is not part of any namespace then I'm not able to use it in ironpython. Here is an example Suppose I have a assembly FooLib.dll with the following class definition //note the following class is not part of global namespace public class Foo { } Now I try to use...

18
голосов
5ответов
21595 просмотров

Ironpython 2.6 .py -> .exe

I already attempted using py2exe (not compatible with ipy) and PYC (out of date). Can anyone point me in the direction of a good compiler?

1
голосов
2ответов
501 просмотров

How do I get hold of my CodeContext in IronPython RC1?

CodeContext is used throughout IronPython. But since I moved to IronPython RC1 I cannot get hold of one. Has anyone used IronPython RC1 and managed to use ClrModule.AddReferenceByName(...) or PythonType.__getattribute__(...) Both of them take a CodeContext and hence I can no longer use ...

0
голосов
2ответов
187 просмотров

Optparse library - callback action while storing arg

My code: def main(): usage = "usage: %prog [options] arg" parser = OptionParser(usage) parser.add_option("-p", "--pending", action="callback", callback=pending, type="string", dest="test", help="View Pending Jobs") (options, args) = parser.parse_args() if x == 0: prin...

2
голосов
1ответов
1117 просмотров

IronPython: How to access trace back local variables

private ScriptEngine pe; private ScriptScope scope; private void button1_Click(object sender, EventArgs e) { pe = Python.CreateEngine(); scope = pe.CreateScope(); pe.Runtime.SetTrace(OnTraceback); pe.Execute(@" def square(x): s = x*x return s a = square(2) + (3) print ""hel...

2
голосов
4ответов
120 просмотров

ruby inside silverlight functionality over c#

Having just found out that you can use Ruby or Python inside a SilverLight application.. link here ..I wonder if its possible to bypass some of the SilverLight limitations with use of these languages instead of C#. I know that the Ruby Engine inside the SilverLight application is trimmed down...

1
голосов
3ответов
1407 просмотров

How to use Sphinx auto-documentation when Python file won't compile

This question is even harder today because I haven't had any luck using the search function on the Sphinx homepage today. I have a group of modules that I want to be documented from the docstrings. However, these are not pure Python scripts. They won't compile as is, because they are run from a ...

4
голосов
4ответов
449 просмотров

Using IronPython to learn the .NET framework, is this bad?

Because I'm a Python fan, I'd like to learn the .NET framework using IronPython. Would I be missing out on something? Is this in some way not recommended? EDIT: I'm pretty knowledgeable of Java ( so learning/using a new language is not a problem for me ). If needed, will I be able to use everyth...

4
голосов
5ответов
807 просмотров

IronPython - How to prevent CLR (and other modules) from being imported

I'm setting up a web application to use IronPython for scripting various user actions and I'll be exposing various business objects ready for accessing by the script. I want to make it impossible for the user to import the CLR or other assemblies in order to keep the script's capabilities simple ...

7
голосов
2ответов
5683 просмотров

Can't use DateTime in IronPython

I'm hosting my IronPython in a C# webapp like so: var engine = Python.CreateEngine(); var scope = engine.CreateScope(); var script = Engine.CreateScriptSourceFromString(pythonCode, SourceCodeKind.Statements); script.Execute(scope); And my python code looks like this: import clr clr.AddReferen...

1
голосов
2ответов
123 просмотров

Where to look up names of .NET assemblies that contain a class or namespace?

In .NET scripting languages such as PowerShell and IronPython, when you want to use a .NET class you typically need to import the assembly name. Is there a quick way to find this information? E.g. if I want to use System.Net.Mail, how do I quickly find out which assembly its in? I'm not necess...

12
голосов
1ответов
3394 просмотров

Getting traceback information from IronPython exceptions

I have IronPython hosted within my application, whenever I catch an exception thrown from a script, I get unhelpful gibberish like this: IronPython.NewTypes.System.Exception_1$1: Error occurred during conversion ---> Microsoft.Scripting.ArgumentTypeException: expected int, got DispMethod a...

3
голосов
3ответов
2021 просмотров

How to construct a PythonTuple from C#

I want to construct an IronPython tuple from C#. These are PythonTuple's public constructors: public PythonTuple(); public PythonTuple(object o); How would I construct, for example, the tuple (1, 2, 3)?

2
голосов
3ответов
1288 просмотров

Are IronPython or IronRuby well-suited for the MVVM pattern in WPF/Silverlight?

I've been very happily using the Model-View-ViewModel (MVVM) pattern in WPF and Silverlight apps in combination with C#. Declarative XAML markup and data binding are invaluable - I just can't live without them. But, this talk by Harry Pierson on dynamic languages got me excited about learning a d...

3
голосов
3ответов
1416 просмотров

How do I clear screen in IronPython console?

When we work with a regular Windows command prompt we can clear the screen by typing cls command. How I can do the same in IronPython console (ipy)?

0
голосов
2ответов
276 просмотров

Colour map in ipython

I am trying to plot some data in ipy. The data consists of three variables alpha,beta and delta. The alpha and beta values are the coordinates of the data points that I wish to plot using a hammer projection. I want to scale the colour of the markers according to the delta values, preferably in a...

1
голосов
4ответов
2561 просмотров

possible to intercept and rewrite email on outlook client side using ironpython?

I want to intercept and transform some automated emails into a more readable format. I believe this is possible using VBA, but I would prefer to manipulate the text with Python. Can I create an ironpython client-side script to pre-process certain emails? EDIT: I believe this can be done with o...

7
голосов
4ответов
7914 просмотров

can you typecast a .NET object in IronPython?

I'm interfacing with a .NET API in IronPython. The API is returning an object of the wrong type (some kind of generic object). I suspect that the problem is not showing up in their C# code because the type declaration when the object is constructed is forcing the returned object to the correct ty...

6
голосов
3ответов
3555 просмотров

Generate and parse Python code from C# application

I need to generate Python code to be more specific IronPyton. I also need to be able to parse the code and to load it into AST. I just started looking at some tools. I played with "Oslo" and made a decision that it's not the right tool for me. I just looked very briefly at Coco/R and it looks pro...

0
голосов
1ответов
242 просмотров

IronPython studio cannot change default font colors

I cannot figure out how to change the default colors in Visual Studio for python files. I have a dark gray background color and black Python code doesn't look very good on that background. I looked in Environment->Fonts and Colors in Option dialog but couldn't find the option to change IronPyt...

11
голосов
3ответов
9587 просмотров

What IronPython IDE should I use?

This question probably looks a lot like IDE for ironpython on windows question here on stackoverflow. But I read the answers on that question I still have no idea what IDE I should use. What I'm looking for is to know pros and cons of a specific IDE. I recently started learning IronPython. Th...

10
голосов
2ответов
7288 просмотров

IronPython libraries for scientific plots

What are good python libraries which IronPython supports (current version wise) for drawing scientific plots on Win ? By "scientific plots" I mean simple x-y plots, x-y-z surface plots and x-y-z shaded plots.

1
голосов
2ответов
609 просмотров

Having problem with IronPython to instantiate a class in IronPython Console

I'm trying to learn IronPython. I created an extremely simple class like this one: class Test: def testMethod(self): print "test" Next I'm trying to use it in IronPython Console: >>> import Test >>> t = Test() After the second line I get following error: TypeErr...

1
голосов
1ответов
1578 просмотров

How to call an IronPython 2 method from C#

I can get an IronPython 2 class back to my C#. What is the new IronPython 2 way of calling a member on that class? object ironPythonClass = scope.GetVariable("Hamish"); object[] args = new object[0]; object pythonObject = engine.Operations.Call(ironPythonClass, args); var member = "Home"; // o...

1
голосов
3ответов
1950 просмотров

Which IDE do I use to develop a mono app in IronPython?

I'm investigating which platform to use for a cross platform GUI app that needs access to the serial port. Currently I'm thinking on using the mono runtime and monodevelop as the IDE. However, I already have a corpus of prototype code written python. Therefore, my idea was to write the mono app i...

1
голосов
2ответов
766 просмотров

Trouble importing third party modules when hosting IronPython in SL

I am hosting Python in a SL app. Basically i have an attached property that lets you pass Python script which then gets executed on the lost focus event of the element. The IPY integration works fine as long as I don't need any 3rd party imports. I copied the formencode package to the site-packa...

15
голосов
5ответов
3564 просмотров

Python - IronPython dilemma

I'm starting to study Python, and for now I like it very much. But, if you could just answer a few questions for me, which have been troubling me, and I can't find any definite answers to them: What is the relationship between Python's C implementation (main version from python.org) and IronPyt...