Re: [IronPython] Need a Good Embedded Example

2007-10-19 Thread Joshua J. Pearce
What am I doing wrong? I have a form with two text boxes and a button. When
I type, "tb.clear()" into the first textbox and click the button, I get the
a MissingMemberException which states, "'TextBox' object has no attribute
'clear'".


public partial class Form1 : Form
{
public static PythonEngine pe = PythonEngine.CurrentEngine;
public Form1()
{
InitializeComponent();

ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable("tb",
textBox2);
}


private void button1_Click(object sender, EventArgs e)
{
pe.ExecuteCommand(textBox1.Text);

}
}


Thanks,

Josh Pearce


On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
>
> I am very sorry! I just noticed this:
>
> ScriptDomainManager.CurrentMan
> ager.Host.DefaultModule.SetVariable("SomeName",
> SomeObject);
>
> SomeObject is then available to user code as SomeName...
>
> That is exactly what I want to do!!!
>
> Thank you very much!
>
>
>
> On 10/18/07, JoeSox <[EMAIL PROTECTED]> wrote:
> >
> > On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> > > My application is ASP.NET, I hardly think integrating CPython is going
> > to be a better choice.
> >
> > You never mentioned you were using ASP.NET. You have mentioned C#.
> >
> > > Is is possible to 'expose' c# methods that exist in the same scope as
> > an IPY
> > > engine,
> >
> > Can you clarify what you mean by this line for me?  Can you provide a
> > C# method  that exists in the same scope as an IPY engine?
> >
> > There must be a custom interface, how would an outside script know
> > about a custom method outside it's scope without an custom interface?
> > Michael and myself have both provided examples.
> >
> > If you have a C# method it must be represented by something else in
> > the script or python code that IronPythonEngine is using, then update
> > the script or python code loaded in the IronPythonEngine using the
> > examples provided.
> >
> > Since I have not seen your source, I don't know why you believe
> > importing the AppService dll and create your own instance in the IP
> > engine will be too much overhead.  That sounds like the bet way to go
> > but I am not familiar with your source.
> > Good Luck!
> > --
> > Later, JoeSox
> > ___
> > Users mailing list
> > Users@lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
>
>
>
> --
> Joshua Pearce
>



-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread Joshua J. Pearce
I am very sorry! I just noticed this:

ScriptDomainManager.CurrentMan
ager.Host.DefaultModule.SetVariable("SomeName",
SomeObject);

SomeObject is then available to user code as SomeName...

That is exactly what I want to do!!!

Thank you very much!



On 10/18/07, JoeSox <[EMAIL PROTECTED]> wrote:
>
> On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> > My application is ASP.NET, I hardly think integrating CPython is going
> to be a better choice.
>
> You never mentioned you were using ASP.NET. You have mentioned C#.
>
> > Is is possible to 'expose' c# methods that exist in the same scope as an
> IPY
> > engine,
>
> Can you clarify what you mean by this line for me?  Can you provide a
> C# method  that exists in the same scope as an IPY engine?
>
> There must be a custom interface, how would an outside script know
> about a custom method outside it's scope without an custom interface?
> Michael and myself have both provided examples.
>
> If you have a C# method it must be represented by something else in
> the script or python code that IronPythonEngine is using, then update
> the script or python code loaded in the IronPythonEngine using the
> examples provided.
>
> Since I have not seen your source, I don't know why you believe
> importing the AppService dll and create your own instance in the IP
> engine will be too much overhead.  That sounds like the bet way to go
> but I am not familiar with your source.
> Good Luck!
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread JoeSox
On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> My application is ASP.NET, I hardly think integrating CPython is going to be 
> a better choice.

You never mentioned you were using ASP.NET. You have mentioned C#.

> Is is possible to 'expose' c# methods that exist in the same scope as an IPY
> engine,

Can you clarify what you mean by this line for me?  Can you provide a
C# method  that exists in the same scope as an IPY engine?

There must be a custom interface, how would an outside script know
about a custom method outside it's scope without an custom interface?
Michael and myself have both provided examples.

If you have a C# method it must be represented by something else in
the script or python code that IronPythonEngine is using, then update
the script or python code loaded in the IronPythonEngine using the
examples provided.

Since I have not seen your source, I don't know why you believe
importing the AppService dll and create your own instance in the IP
engine will be too much overhead.  That sounds like the bet way to go
but I am not familiar with your source.
Good Luck!
-- 
Later, JoeSox
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread Joshua J. Pearce
My application is ASP.NET, I hardly think integrating CPython is going to be
a better choice.

I really hope I can be clear this time and not encourage suggestions to do
all kinds of other stuff that what I am asking about, so here it goes:

Is is possible to 'expose' c# methods that exist in the same scope as an IPY
engine, to that engine so that an arbitrary one of those methods might be
called by python code code that that engine executes?

Thanks,

Josh Pearce

On 10/18/07, JoeSox <[EMAIL PROTECTED]> wrote:
>
> On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> > Ah, because I am trying to use Iron Python as a scripting language for
> my
> > application. I want to expose a limited subset of my appservice
> functions to
> > the scripting language,and let users write scripts.
>
> Personally, I would just use Python as the scripting for a number of
> reasons.
> 1) IronPython is a .Net library not a language
> 2) IronPython supports Python language modules (to a certain point)
> 3) Possibly provides compatibility to CPython and IronPython
>
> I believe this would be a better design for your application and be
> better in the long run, esp. as IronPython grows and changes rapidly.
> This is mainly why I designed pswrdgen and pswrdgeniron this way.
> However, just my two cents and not fully aware of your apps specific
> details.
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread JoeSox
On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> Ah, because I am trying to use Iron Python as a scripting language for my
> application. I want to expose a limited subset of my appservice functions to
> the scripting language,and let users write scripts.

Personally, I would just use Python as the scripting for a number of reasons.
1) IronPython is a .Net library not a language
2) IronPython supports Python language modules (to a certain point)
3) Possibly provides compatibility to CPython and IronPython

I believe this would be a better design for your application and be
better in the long run, esp. as IronPython grows and changes rapidly.
This is mainly why I designed pswrdgen and pswrdgeniron this way.
However, just my two cents and not fully aware of your apps specific details.
-- 
Later, JoeSox
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread Michael Foord
Joshua J. Pearce wrote:
> Joesox,
>
> Thank you very much! Now, what if I the getcount() method was actually 
> getcount(string arg1), is there a way to call it from within the IP 
> script? Or do I need to parse the IP script ahead of time, and call 
> the function myself? That would be like writing my own scripting 
> language, so I hope there is a way to call the method from within IP 
> scripts.
 You should be able to place objects into the 'user scope' using the 
same SetVariable technique. That way the user can call methods on these 
objects from their code.

ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable("SomeName",
SomeObject);

SomeObject is then available to user code as SomeName...

Michael
http://www.manning.com/foord



>
> Many thanks!
>
> - Josh Pearce
>
> On 10/18/07, *JoeSox* <[EMAIL PROTECTED] > wrote:
>
> On 10/17/07, Joshua J. Pearce <[EMAIL PROTECTED]
> > wrote:
> > OK, please forgive my earlier vagueness. What I want to do is as
> follows:
> >
> > pe = PythonEngine.CurrentEngine ;
> >
> > //create a instance of my applications business logic layer class
> > myAppService = new AppService(_token);
> >
> > //I want to be able to somehow make methods from the
> myAppService class
> > available to be called from Iron Python code.
> >
> > //I know I could import the AppService dll and create my own
> instance in the
> > IP engine, but that's way too much overhead.
> >
> > //How can I say: "Hey, pe, here is a method on my object,
> myAppService, that
> > I want you to make available when you execute a command?
>
>
> What are the return values of myAppService.ServiceMethod()?
> Depending upon these values, you will need to handle them before
> sending them to the pe.
>
> So it sounds like you need something like:
>
> public int COUNT;
>
> private void MyIPGetCount()
> {
>   //Call your Service method and assign return value to a global
>   COUNT = myAppService.getcount ();
>
>   //Create variable bridge from C# to IronPython engine
>   //I like to pretend I am just using a IP command line to help
> figure out what I need to do
>   pe.ExecuteCommand("PyCount = 0");
>
>   //Set the IronPython bridge variables...
>   
> ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable("PyCount",
> COUNT);
> pe.ExecuteCommand("PyCountTwo = PyCount");
> }
>
> This is a simplified version of what I am guess what you need to do
> but there you go.
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com 
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> -- 
> Joshua Pearce
> 
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread Joshua J. Pearce
Ah, because I am trying to use Iron Python as a scripting language for my
application. I want to expose a limited subset of my appservice functions to
the scripting language,and let users write scripts.

On 10/18/07, JoeSox <[EMAIL PROTECTED]> wrote:
>
> On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> > Joesox,
> >
> > Thank you very much! Now, what if I the getcount() method was actually
> > getcount(string arg1), is there a way to call it from within the IP
> script?
>
> I don't see why you would want to if you are using an IronPythonEngine
>
> Just do...
>  //Call your Service method and assign return value to a global
>  COUNT = myAppService.getcount("my arg1");
>
> > Or do I need to parse the IP script ahead of time, and call the function
> > myself? That would be like writing my own scripting language, so I hope
> > there is a way to call the method from within IP scripts.
>
> I still don't see why you would need it in the script if you are using C#.
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread JoeSox
On 10/18/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> Joesox,
>
> Thank you very much! Now, what if I the getcount() method was actually
> getcount(string arg1), is there a way to call it from within the IP script?

I don't see why you would want to if you are using an IronPythonEngine

Just do...
 //Call your Service method and assign return value to a global
 COUNT = myAppService.getcount("my arg1");

> Or do I need to parse the IP script ahead of time, and call the function
> myself? That would be like writing my own scripting language, so I hope
> there is a way to call the method from within IP scripts.

I still don't see why you would need it in the script if you are using C#.
-- 
Later, JoeSox
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread Joshua J. Pearce
Joesox,

Thank you very much! Now, what if I the getcount() method was actually
getcount(string arg1), is there a way to call it from within the IP script?
Or do I need to parse the IP script ahead of time, and call the function
myself? That would be like writing my own scripting language, so I hope
there is a way to call the method from within IP scripts.

Many thanks!

- Josh Pearce

On 10/18/07, JoeSox <[EMAIL PROTECTED]> wrote:
>
> On 10/17/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> > OK, please forgive my earlier vagueness. What I want to do is as
> follows:
> >
> > pe = PythonEngine.CurrentEngine;
> >
> > //create a instance of my applications business logic layer class
> > myAppService = new AppService(_token);
> >
> > //I want to be able to somehow make methods from the myAppService class
> > available to be called from Iron Python code.
> >
> > //I know I could import the AppService dll and create my own instance in
> the
> > IP engine, but that's way too much overhead.
> >
> > //How can I say: "Hey, pe, here is a method on my object, myAppService,
> that
> > I want you to make available when you execute a command?
>
>
> What are the return values of myAppService.ServiceMethod()?
> Depending upon these values, you will need to handle them before
> sending them to the pe.
>
> So it sounds like you need something like:
>
> public int COUNT;
>
> private void MyIPGetCount()
> {
>   //Call your Service method and assign return value to a global
>   COUNT = myAppService.getcount();
>
>   //Create variable bridge from C# to IronPython engine
>   //I like to pretend I am just using a IP command line to help
> figure out what I need to do
>   pe.ExecuteCommand("PyCount = 0");
>
>   //Set the IronPython bridge variables...
>   ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable
> ("PyCount",
> COUNT);
> pe.ExecuteCommand("PyCountTwo = PyCount");
> }
>
> This is a simplified version of what I am guess what you need to do
> but there you go.
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread JoeSox
On 10/17/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> OK, please forgive my earlier vagueness. What I want to do is as follows:
>
> pe = PythonEngine.CurrentEngine;
>
> //create a instance of my applications business logic layer class
> myAppService = new AppService(_token);
>
> //I want to be able to somehow make methods from the myAppService class
> available to be called from Iron Python code.
>
> //I know I could import the AppService dll and create my own instance in the
> IP engine, but that's way too much overhead.
>
> //How can I say: "Hey, pe, here is a method on my object, myAppService, that
> I want you to make available when you execute a command?


What are the return values of myAppService.ServiceMethod()?
Depending upon these values, you will need to handle them before
sending them to the pe.

So it sounds like you need something like:

public int COUNT;

private void MyIPGetCount()
{
  //Call your Service method and assign return value to a global
  COUNT = myAppService.getcount();

  //Create variable bridge from C# to IronPython engine
  //I like to pretend I am just using a IP command line to help
figure out what I need to do
  pe.ExecuteCommand("PyCount = 0");

  //Set the IronPython bridge variables...
  
ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable("PyCount",
COUNT);
pe.ExecuteCommand("PyCountTwo = PyCount");
}

This is a simplified version of what I am guess what you need to do
but there you go.
-- 
Later, JoeSox
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-18 Thread Michael Foord
Hello Joshua,

I'll take a look at this.

It is really easy for IronPython 1 and everything has changed for IP 2 
(and the docs are not exactly complete).

It just takes a bit of exploration. You need to be able to set some 
globals in the default module (where you can make your .NET objects 
available to IP code - and then pull the globals back out after 
executing the Python).

Michael
http://www.manning.com/foord

Joshua J. Pearce wrote:
> OK, please forgive my earlier vagueness. What I want to do is as follows:
>
> pe = PythonEngine.CurrentEngine;
>
> //create a instance of my applications business logic layer class
> myAppService = new AppService(_token);
>
> //I want to be able to somehow make methods from the myAppService 
> class available to be called from Iron Python code.
> //I know I could import the AppService dll and create my own instance 
> in the IP engine, but that's way too much overhead.
>
> //How can I say: "Hey, pe, here is a method on my object, 
> myAppService, that I want you to make available when you execute a 
> command?
>
> Thanks,
>
> -Josh Pearce
>
>
>
>
> On 10/17/07, *JoeSox* <[EMAIL PROTECTED] > wrote:
>
> On 10/17/07, Joshua J. Pearce <[EMAIL PROTECTED]
> > wrote:
> > I am looking for an embedded IronPython 2.0 example beyond the
> simple hello
> > world one I quoted before.
> >
> > What I want to know is:
> >
> > 1) How to get variable output from the script back to my c# code.
>
> I have a quick section in this article...
> http://www.codeproject.com/useritems/pswrdgeniron.asp
>
> You can view the source here...
> 
> http://pswrdgen.googlecode.com/svn/trunk/pswrdgeniron/pswrdgeniron/Form1.cs
> 
> 
>
> 
> Microsoft.Scripting.ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable
>
> > 2) How to call scripts with multiple statements.
>
> multiple statements? Do you mean call the methods in an imported
> script?
>
> > 3) Do all variables need to be set on the script object, or can
> their
> > declaration just be part of the script code?
>
> It depends what you are doing and how your app is designed.
>
> > 4) Is there a good and simple example anywhere that shows how to
> host the
> > IronPython engine in a c# app and let users manipulate your
> program objects
> > via ipy scripts?
>
> My article above.
>
> > 5) How can I expose c# methods to as IPY functions?
>
> Not sure I understand your question here. Can't you have a c# method
> then do something like pe.Execute("my py code here")?
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com 
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> -- 
> Joshua Pearce
> 
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-17 Thread Joshua J. Pearce
OK, please forgive my earlier vagueness. What I want to do is as follows:

pe = PythonEngine.CurrentEngine;

//create a instance of my applications business logic layer class
myAppService = new AppService(_token);

//I want to be able to somehow make methods from the myAppService class
available to be called from Iron Python code.
//I know I could import the AppService dll and create my own instance in the
IP engine, but that's way too much overhead.

//How can I say: "Hey, pe, here is a method on my object, myAppService, that
I want you to make available when you execute a command?

Thanks,

-Josh Pearce




On 10/17/07, JoeSox <[EMAIL PROTECTED]> wrote:
>
> On 10/17/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> > I am looking for an embedded IronPython 2.0 example beyond the simple
> hello
> > world one I quoted before.
> >
> > What I want to know is:
> >
> > 1) How to get variable output from the script back to my c# code.
>
> I have a quick section in this article...
> http://www.codeproject.com/useritems/pswrdgeniron.asp
>
> You can view the source here...
>
> http://pswrdgen.googlecode.com/svn/trunk/pswrdgeniron/pswrdgeniron/Form1.cs
>
>
> Microsoft.Scripting.ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable
>
> > 2) How to call scripts with multiple statements.
>
> multiple statements? Do you mean call the methods in an imported script?
>
> > 3) Do all variables need to be set on the script object, or can their
> > declaration just be part of the script code?
>
> It depends what you are doing and how your app is designed.
>
> > 4) Is there a good and simple example anywhere that shows how to host
> the
> > IronPython engine in a c# app and let users manipulate your program
> objects
> > via ipy scripts?
>
> My article above.
>
> > 5) How can I expose c# methods to as IPY functions?
>
> Not sure I understand your question here. Can't you have a c# method
> then do something like pe.Execute("my py code here")?
> --
> Later, JoeSox
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-17 Thread JoeSox
On 10/17/07, Joshua J. Pearce <[EMAIL PROTECTED]> wrote:
> I am looking for an embedded IronPython 2.0 example beyond the simple hello
> world one I quoted before.
>
> What I want to know is:
>
> 1) How to get variable output from the script back to my c# code.

I have a quick section in this article...
http://www.codeproject.com/useritems/pswrdgeniron.asp

You can view the source here...
http://pswrdgen.googlecode.com/svn/trunk/pswrdgeniron/pswrdgeniron/Form1.cs

Microsoft.Scripting.ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable

> 2) How to call scripts with multiple statements.

multiple statements? Do you mean call the methods in an imported script?

> 3) Do all variables need to be set on the script object, or can their
> declaration just be part of the script code?

It depends what you are doing and how your app is designed.

> 4) Is there a good and simple example anywhere that shows how to host the
> IronPython engine in a c# app and let users manipulate your program objects
> via ipy scripts?

My article above.

> 5) How can I expose c# methods to as IPY functions?

Not sure I understand your question here. Can't you have a c# method
then do something like pe.Execute("my py code here")?
-- 
Later, JoeSox
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Need a Good Embedded Example

2007-10-17 Thread Joshua J. Pearce
I am looking for an embedded IronPython 2.0 example beyond the simple hello
world one I quoted before.

What I want to know is:

1) How to get variable output from the script back to my c# code.

2) How to call scripts with multiple statements.

3) Do all variables need to be set on the script object, or can their
declaration just be part of the script code?

4) Is there a good and simple example anywhere that shows how to host the
IronPython engine in a c# app and let users manipulate your program objects
via ipy scripts?

5) How can I expose c# methods to as IPY functions?

Thanks,

-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-16 Thread Dino Viehland
Yep, we've temporarily ripped out all pre-compilation support from v2.0 to make 
the refactoring work easier so pyc definitely won't work there (and there's 
really no way to make it work there w/o a rather large amount of work).

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
Sent: Tuesday, October 16, 2007 2:40 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Need a Good Embedded Example

Hi Dino,

Is this why I am having trouble with the pyc.py sample? It does say
1.01 in the description so maybe I should expect issues :-)

Traceback (most recent call last):
  File pyc.py, line 35, in Initialize
  File , line 0, in _stub_##227
AttributeError: 'NamespaceTracker' object has no attribute 'CompilerSink'

Thanks,
Davy

On 10/16/07, Dino Viehland <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Are you looking for samples in v1.0 or v2.0?  The code you quoted below is
> some version of v2.0 (we're still working on the final tweaks to what will
> become the new, final, hosting model).
>
>
>
>
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Joshua J. Pearce
>  Sent: Tuesday, October 16, 2007 2:08 PM
>  To: users@lists.ironpython.com
>  Subject: [IronPython] Need a Good Embedded Example
>
>
>
>
>
> I have been looking for a good example of embedding IronPython in a c#
> application. I am under the impression that there have been some major
> changes in the way this is done from version 1.1 to 2.0.
>
>
>
>
>
> This is what I found at the Python Cookbook site:
>
>
>
>
>
> namespace IronPythonScriptHost
>  {
>  class Program
>  {
>  static void Main(string[] args)
>  {
>  string code = "print \"Hello \" + Name";
>  Script.SetVariable ("Name", "Me");
>  Script.Execute("py", code);
>  }
>  }
>  }
>
>
>
>
>
> That's nice, but doesn't really help me to know how to get variable output
> from the script back to my c# code. I also need to know how to call scripts
> with multiple statements and whether all variables need to be set on the
> script object, or can their declaration just be part of the script code.
>
>
>
>
>
> Is there a good and simple example anywhere that shows how to host the
> IronPython engine in a c# app and let users manipulate your program objects
> via ipy scripts?
>
>
>
>
>
> Thanks!
>
>  --
>  Joshua Pearce
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>


--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-16 Thread Davy Mitchell
Hi Dino,

Is this why I am having trouble with the pyc.py sample? It does say
1.01 in the description so maybe I should expect issues :-)

Traceback (most recent call last):
  File pyc.py, line 35, in Initialize
  File , line 0, in _stub_##227
AttributeError: 'NamespaceTracker' object has no attribute 'CompilerSink'

Thanks,
Davy

On 10/16/07, Dino Viehland <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Are you looking for samples in v1.0 or v2.0?  The code you quoted below is
> some version of v2.0 (we're still working on the final tweaks to what will
> become the new, final, hosting model).
>
>
>
>
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Joshua J. Pearce
>  Sent: Tuesday, October 16, 2007 2:08 PM
>  To: users@lists.ironpython.com
>  Subject: [IronPython] Need a Good Embedded Example
>
>
>
>
>
> I have been looking for a good example of embedding IronPython in a c#
> application. I am under the impression that there have been some major
> changes in the way this is done from version 1.1 to 2.0.
>
>
>
>
>
> This is what I found at the Python Cookbook site:
>
>
>
>
>
> namespace IronPythonScriptHost
>  {
>  class Program
>  {
>  static void Main(string[] args)
>  {
>  string code = "print \"Hello \" + Name";
>  Script.SetVariable ("Name", "Me");
>  Script.Execute("py", code);
>  }
>  }
>  }
>
>
>
>
>
> That's nice, but doesn't really help me to know how to get variable output
> from the script back to my c# code. I also need to know how to call scripts
> with multiple statements and whether all variables need to be set on the
> script object, or can their declaration just be part of the script code.
>
>
>
>
>
> Is there a good and simple example anywhere that shows how to host the
> IronPython engine in a c# app and let users manipulate your program objects
> via ipy scripts?
>
>
>
>
>
> Thanks!
>
>  --
>  Joshua Pearce
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>


-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Need a Good Embedded Example

2007-10-16 Thread Dino Viehland
Are you looking for samples in v1.0 or v2.0?  The code you quoted below is some 
version of v2.0 (we're still working on the final tweaks to what will become 
the new, final, hosting model).

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joshua J. Pearce
Sent: Tuesday, October 16, 2007 2:08 PM
To: users@lists.ironpython.com
Subject: [IronPython] Need a Good Embedded Example

I have been looking for a good example of embedding IronPython in a c# 
application. I am under the impression that there have been some major changes 
in the way this is done from version 1.1 to 2.0.

This is what I found at the Python Cookbook site:

namespace IronPythonScriptHost
{
class Program
{
static void Main(string[] args)
{
string code = "print \"Hello \" + Name";
Script.SetVariable ("Name", "Me");
Script.Execute("py", code);
}
}
}

That's nice, but doesn't really help me to know how to get variable output from 
the script back to my c# code. I also need to know how to call scripts with 
multiple statements and whether all variables need to be set on the script 
object, or can their declaration just be part of the script code.

Is there a good and simple example anywhere that shows how to host the 
IronPython engine in a c# app and let users manipulate your program objects via 
ipy scripts?

Thanks!

--
Joshua Pearce

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Need a Good Embedded Example

2007-10-16 Thread Joshua J. Pearce
I have been looking for a good example of embedding IronPython in a c#
application. I am under the impression that there have been some major
changes in the way this is done from version 1.1 to 2.0.

This is what I found at the Python Cookbook site:

namespace IronPythonScriptHost
{
class Program
{
static void Main(string[] args)
{
string code = "print \"Hello \" + Name";
Script.SetVariable("Name", "Me");
Script.Execute("py", code);
}
}
}

That's nice, but doesn't really help me to know how to get variable output
from the script back to my c# code. I also need to know how to call scripts
with multiple statements and whether all variables need to be set on the
script object, or can their declaration just be part of the script code.

Is there a good and simple example anywhere that shows how to host the
IronPython engine in a c# app and let users manipulate your program objects
via ipy scripts?

Thanks!

-- 
Joshua Pearce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com