[IronPython] Porting from CPython: Figuring out the calling code's directory

2008-11-06 Thread Ori Peleg
Hi, I'm porting Testoob to IronPython and have a module function that needs to know the filename where the code calling it is defined. In CPython I get the current frame with sys._getframe(), then climb the stack with frame.f_back until I find a different file: def _first_external_frame():

[IronPython] Using blocks separators instead of indentation

2007-08-13 Thread Ori
Hello, Is there a way to use code blocks (like { and } in other languages) instead of indentation? Thanks, Ori -- View this message in context: http://www.nabble.com/Using-blocks-separators-instead-of-indentation-tf4259431.html#a12121490 Sent from the IronPython mailing list archive

Re: [IronPython] Using blocks separators instead of indentation

2007-08-13 Thread Ori
OK I got the point. I have to use several statements in a single line. For exmpale, something like: i = 1; if (i =1): i = 0 is there a way to do it? Is there a replacement to the newline char? Thanks. Ori wrote: Hello, Is there a way to use code blocks (like { and } in other

Re: [IronPython] Using blocks separators instead of indentation

2007-08-13 Thread Ori
Thanks but I did not ask if it is ugly or not. I just need it. Is there a way to do it? Curt Hagenlocher wrote: On 8/13/07, Ori [EMAIL PROTECTED] wrote: OK I got the point. I have to use several statements in a single line. For exmpale, something like: i = 1; if (i =1): i = 0

[IronPython] Compiler error for invalid field access

2007-08-05 Thread Ori
(); it works find for finding syntax mistakes - but I also wan to know about invalid property names / method names. If for example the code uses the expression 'self.Name' I would like to see a compilation error if the object does not have a 'Name' property. Is there a way to do it? Thanks, Ori

Re: [IronPython] Compiler error for invalid field access

2007-08-05 Thread Ori
:51PM -0700, Ori wrote: Hello, I'm using the following code to compile python code: SystemState state = new SystemState(); MyCompilerSink sink = new MyCompilerSink(); CompilerContext context = new CompilerContext(string.Empty, sink); Parser parser = Parser.FromString(state, context, my

Re: [IronPython] Compiler error for invalid field access

2007-08-05 Thread Ori - Gmail
To: Discussion of IronPython Subject: Re: [IronPython] Compiler error for invalid field access Ori wrote: Executing the code to know if there is a problem or not is not what I wish for. I really can't do it because in my case the context does not exist. I will try to create a 'fake' context in order

[IronPython] Inheritance from a c# subclass

2007-08-04 Thread Ori
to do it? Thanks, Ori -- View this message in context: http://www.nabble.com/Inheritance-from-a-c--subclass-tf4216398.html#a11995601 Sent from the IronPython mailing list archive at Nabble.com. ___ Users mailing list Users@lists.ironpython.com http

[IronPython] avoiding using the keyword 'self'

2007-08-04 Thread Ori
class. Is there a way to avoid this prefix? Thanks, Ori -- View this message in context: http://www.nabble.com/avoiding-using-the-keyword-%27self%27-tf4216418.html#a11995646 Sent from the IronPython mailing list archive at Nabble.com. ___ Users

Re: [IronPython] avoiding using the keyword 'self'

2007-08-04 Thread Ori
I guess the answer is no, and I must explicitly use the 'self.' prefix. About the syntax error - you are right, there is one in the post, but it has nothing to do with ineriting from a sub-class Ori wrote: Hello, I have a python class which inherits from some other (c#) class. Something

Re: [IronPython] .NET can see Python classes?

2007-08-04 Thread Ori
you can try the following code: PythonEngine engine = new PythonEngine(); EngineModule module = engine.CreateModule(); engine.Execute(handleCode(code, def), module); # code contains definition for python class 'PyClass' UserType ptype = module.Globals[PyClass] as UserType; object obj =

[IronPython] Find the compile erros

2007-08-03 Thread Ori
Hello, I'm using PythonEngine.Compile to compile code. The code I compile may contain errors and that's why I want to format the error(s). Currently I'm using try-catch and I work with the exception error text. Is there a btter way to get the compilation errors? Thanks, Ori -- View

Re: [IronPython] Find the compile erros

2007-08-03 Thread Ori
CompilerSink object will get called back w/ the errors. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ori Sent: Thursday, August 02, 2007 11:42 PM To: users@lists.ironpython.com Subject: [IronPython] Find the compile erros Hello, I'm using

Re: [IronPython] Find the compile erros

2007-08-03 Thread Ori
, the CompilerContext is IronPython.Compiler.CompilerContext, and the CompilerSink which you need to derive from and override AddError is IronPython.Hosting.CompilerSink. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ori Sent: Friday, August 03

Re: [IronPython] Find the compile erros

2007-08-03 Thread Ori
); but the AddError method was not called. Dino Viehland wrote: The FromFile and FromString methods are public static methods on the Parser class that create the Parser object. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ori Sent: Friday, August 03

[IronPython] Declare a class in Python and use it in .net

2007-08-02 Thread Ori
Hello, I have a .net class (in some assembly). I want to inherit from it and override a function in it - with python code. I'm using c# to compile the python code, and after the compilation is done I want to create an instance of the new class inside c#. Is there a way to do it? Thanks, Ori

[IronPython] Some questions about Iron-Python

2007-08-01 Thread Ori
compiled code in memory and use it to evaluate code multiple times? I've seen there is a CompiledCode object but I saw only an Execute method. Thanks, Ori -- View this message in context: http://www.nabble.com/Some-questions-about-Iron-Python-tf4198487.html#a11940989 Sent from the IronPython mailing