I totally agree that it should be done the right way - I didn't know
what the right way was.
CodePlex issue has been opened: 21040
Thanks!
Dino Viehland wrote:
> And the correct change to the source code would be adding __repr__ methods to
> the various *Ops types (Int16Ops, UInt16Ops, etc...)
((sbyte)o).ToString();
if (o is char) return ((char)o).ToString();
if (o is Int16) return ((Int16)o).ToString();
if (o is UInt16) return ((UInt16)o).ToString();
?
Jeff Slutter wrote:
> I have functions (in C#) that return results as everything from byte,
> sbyte
I have functions (in C#) that return results as everything from byte,
sbyte, System.UInt16, int, uint, float, etc.
If I use repr() on the returned value within IP2.0 only bool, int,
int64, float, double and string types print out a nice value using repr.
The other types (byte, char, sbyte, uint16
My situation is that I have a .py file that defines a function. In this
function it makes reference to some variables that aren't defined in its
scope:
(in a very simple way, it is like this -- a lot more is going on, but it
isn't relevant)
import MyModule
def TestFunction(x):
return SomeClass
Aha! That looks like exactly what I need! It will take some tweaking of
the code, but this should give me the information I need to route things
properly.
Now, I just need to find out if I can do something similar for
System.Console, but I can live with it if I can't for that one. Python
output wa
Dino Viehland wrote:
> You can always provide your own stream which is aware of what the current
> output window is. It could store this in a thread static or just some
> variable that you update whenever the active window changes. You can set
> that via ScriptRuntime.IO.OutputStream. You cou
I have a bit of a problem that I'm not sure how to solve. In my
application, I have multiple documents, and each can possibly be
performing script operations that print text out via the "print"
function. I have one "script output" window, which, only shows the
output of whichever is the active docu
If there a way for me to intercept when IronPython wants to import a
script, so I can provide the script text through my own ways. I have a
situation where my Python files are not files on the disk, but packed
into a zip file. When I go to run a script I can get the source to
IronPython to run, but
Curt Hagenlocher wrote:
> If you're willing to live on the bleeding edge and build from the latest
> sources, it turns out that Tomas just added this functionality to the
> hosting interfaces yesterday. ObjectOperations.Format(obj) should return
> a string that matches what the REPL would have prin
Given an object, how can I go about printing out that object as a string
representing the object in Python syntax?
I need something a little more powerful than just object.ToString()
I need something like how the interactive console reports the result of
the statement.
For instance:
a = [0,1,2]
exception in the call to Python.CreateEngine()
(Note: the exception exists without all the extra LoadAssemblys and
stripped to the bone).
Michael Foord wrote:
> Jeff Slutter wrote:
>> [I can work around this, but I'm curious if there is a solution]
>>
>> Due to some crazy requirements,
[I can work around this, but I'm curious if there is a solution]
Due to some crazy requirements, I'm trying to load my assemblies from
memory. I have setup an Assembly Resolver with:
AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(ResolveInternalAssembly);
And it gets called.
I have a Python script that creates a class within it. This Python class
is derived off of a class, or interface, I made in C# - something like:
class MyClass(Test.MainForm.IScript):
...
Now, back in C#, I have gotten access to "MyClass" by:
object myclass = someScope.GetVariable("MyClass");
Excuse me if this is known or not, but searching around has only turned
up articles/mailing lists posts that are two years old, but does
IronPython 2.0 support .NET attributes yet?
I've seen some examples of doing it using stub classes in C# and then
deriving from the in Python, but I'm not sure i
I'm working on getting an interactive script console into my
application. Information on how to do this is a bit hard to find but I
came across an app.py by Jim Hugunin showing how to do it with Silverlight.
I based my C# app around that and have something working pretty well.
I'm always using Sou
I have found another way that better suits what I'm trying to do (and
control).
In a nutshell, I just add the function to the builtins. Here is the code:
// some member function, etc.
delegate int DoDelegate();
private int DoFunc()
{
return 10;
}
//... in the IronPython initialization, after t
Actually this doesn't exactly work. If I want the command to be able to
return a value, I can't go with the constructor route:
res = AddNumbers( 3, 5 );
you want res equal to "8", but really it is an instance of my AddNumbers
class. I don't want the script writers to be able to save this class
in
Ok, now I feel a little stupid. Thanks :)
I think it would be wise to drop the "params object[] args" and go with
just actually specifying the parameters to the constructor so I can take
advantage of type checking, etc. from Python.
In the constructor I'll have to save the instance of the class c
I'm writing an application that I want to provide runtime scripting via
IronPython for. This application loads "plug-ins" from assemblies to add
functionality.
Each plug-in is a class with, for the sake of simplicity, a "Do" function.
What I'm trying to figure out is that if I have a class like:
I'm going through the IronPython tutorial and I'm at the COM interop
part. I'm trying to get the Merlin example working but I can't get it
past a certain part.
First of all, I had to make some changes to get the example to work, as
it doesn't appear the tuple/out param stuff works the same as it d
20 matches
Mail list logo