Re: [IronPython] Redirecting stdout/stderr, but with context

2009-01-30 Thread Jeff Slutter
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

Re: [IronPython] Redirecting stdout/stderr, but with context

2009-01-30 Thread Dino Viehland
Can you run each document on its own thread? Oh, it also looks like we actually flow CodeContext through to the caller. So you could do something like: class MyFile { public void write(CodeContext context, string data) { Scope curScope = context.Scope; // this gi

Re: [IronPython] Redirecting stdout/stderr, but with context

2009-01-30 Thread Jeff Slutter
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

Re: [IronPython] Redirecting stdout/stderr, but with context

2009-01-30 Thread Dino Viehland
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 could conceptually do the exact

[IronPython] Redirecting stdout/stderr, but with context

2009-01-30 Thread Jeff Slutter
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

[IronPython] Optimised tail calls

2009-01-30 Thread Michael Foord
Hello all, It occurs to me; CPython doesn't have optimised tail calls, but no reason that IronPython shouldn't! Please vote up: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20927 :-) Michael -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog ___

Re: [IronPython] Two engines and clr.AddReference don't work together.

2009-01-30 Thread Michael Foord
Dino Viehland wrote: Yep, and I'm happy to move back to the old behavior - being consistent w/ ourselves and broken seems better than being inconsistent w/ ourselves and broken :) Better a foolish consistency than uhm... the opposite. :-) Michael -Original Message- From: users-bo

Re: [IronPython] Two engines and clr.AddReference don't work together.

2009-01-30 Thread Dino Viehland
Yep, and I'm happy to move back to the old behavior - being consistent w/ ourselves and broken seems better than being inconsistent w/ ourselves and broken :) -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foo

Re: [IronPython] Two engines and clr.AddReference don't work together.

2009-01-30 Thread Michael Foord
Dino Viehland wrote: You're right that it worked in 1.0 - but of course in 1.0 we would also end up with an arbitrary ordering between engines. For example you could have: Engine 1: Sys.path = C:\ Contains "Foo.dll" Engine 2: Sys.Path = D:\ Cont

Re: [IronPython] Two engines and clr.AddReference don't work together.

2009-01-30 Thread Dino Viehland
You're right that it worked in 1.0 - but of course in 1.0 we would also end up with an arbitrary ordering between engines. For example you could have: Engine 1: Sys.path = C:\ Contains "Foo.dll" Engine 2: Sys.Path = D:\ Contains "Foo.dll" Which F

Re: [IronPython] Two engines and clr.AddReference don't work together.

2009-01-30 Thread Curt Hagenlocher
How do we love thee, Fusion? Let me count the ways... On Fri, Jan 30, 2009 at 10:34 AM, Tom Wright wrote: > Hi, > > Having two engines in the same AppDomain causes interesting behaviour when > trying trying to add references. > > Only the sys.path of the first engine that was created seems to be

[IronPython] Two engines and clr.AddReference don't work together.

2009-01-30 Thread Tom Wright
Hi, Having two engines in the same AppDomain causes interesting behaviour when trying trying to add references. Only the sys.path of the first engine that was created seems to be taken into account when calling clr.AddReference, the second sys.path is ignored. See http://www.codeplex.com/I

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Slide
http://www.network-theory.co.uk/docs/pytut/Packages.html That will explain better. slide On Fri, Jan 30, 2009 at 10:39 AM, Severin wrote: > Ok, that's very helpful. > I didn't know that. > Thanks, > Severin > > On Fri, Jan 30, 2009 at 6:29 PM, Michael Foord > wrote: >> >> Severin wrote: >>> >>

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Severin
Ok, that's very helpful. I didn't know that. Thanks, Severin On Fri, Jan 30, 2009 at 6:29 PM, Michael Foord wrote: > Severin wrote: > >> Good point! I forgot that I was having the *.py files in a subdirectory. >> >> Is it also possible to set the 'current' directory for the engine? >> >> For ins

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Slide
You could also make the files in the subdirectory a module and write a __init__.py to import the other items. On Fri, Jan 30, 2009 at 10:28 AM, Severin wrote: > yes, thats what I did. > > but then I have relative path's in the python code. to open a file for > instance. > lets say ./py is my subd

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Michael Foord
Severin wrote: yes, thats what I did. but then I have relative path's in the python code. to open a file for instance. lets say ./py is my subdirectory. there I have a settings.ini and a main.py file. adding ./py to the path I am able to run main.py with the DLR but not doing something li

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Michael Foord
Severin wrote: Good point! I forgot that I was having the *.py files in a subdirectory. Is it also possible to set the 'current' directory for the engine? For instance I would like to have the engine living in a subfolder of my project and then all path's would be relative to this subfolder.

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Severin
yes, thats what I did. but then I have relative path's in the python code. to open a file for instance. lets say ./py is my subdirectory. there I have a settings.ini and a main.py file. adding ./py to the path I am able to run main.py with the DLR but not doing something like open('settings.ini'

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Slide
On Fri, Jan 30, 2009 at 10:01 AM, Severin wrote: > Good point! I forgot that I was having the *.py files in a subdirectory. > Is it also possible to set the 'current' directory for the engine? > For instance I would like to have the engine living in a subfolder of my > project and then all path's

[IronPython] Overflow error with C# dll

2009-01-30 Thread Kristian
I've created a C# dll that I call from Ironpython (Silverlight) application. I receive an Overflow error when I call it but I can't see that anything is wrong. Everything works as expected. The error is below: "OverflowError: Arithmetic operation resulted in an overflow." But when I call the same

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Severin
Good point! I forgot that I was having the *.py files in a subdirectory. Is it also possible to set the 'current' directory for the engine? For instance I would like to have the engine living in a subfolder of my project and then all path's would be relative to this subfolder. thank you, Severin

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Michael Foord
Severin wrote: Hello, I'm digging out this thread again. I'm trying to run python scripts from C# using the DLR. Simple examples work, namely if I have just one function in one python file. How does it work when one python file imports from another python file? I get "No module named x" Im

Re: [IronPython] Embedding IronPython 2.0

2009-01-30 Thread Severin
Hello, I'm digging out this thread again. I'm trying to run python scripts from C# using the DLR. Simple examples work, namely if I have just one function in one python file. How does it work when one python file imports from another python file? I get "No module named x" ImportExceptions when t