[IronPython] PythonEngine.RunFile

Tim Riley riltim at gmail.com
Fri Aug 11 14:17:54 CEST 2006


Thank you both. I will give that a shot.

On 8/10/06, Shri Borde <Shri.Borde at microsoft.com> wrote:
>
>  __name___ == "__main__": is a convention enforced by ipy.exe. The
> PythonEngine itself does not directly support this concept. However, you can
> achieve that result (just like ipy.exe does) by using code like this:
>
>
>
> PythonEngine engine = new PythonEngine();
>
> EngineModule module = engine.CreateModule("__main__", false);
>
> engine.ExecuteFile(filename, module);
>
>
>
> *________*
>
> Do you want to help develop Dynamic languages on CLR?<http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038>
> (
> http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038
> )
>
> *From:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *On Behalf Of *Martin Maly
> *Sent:* Thursday, August 10, 2006 3:06 PM
>
> *To:* Discussion of IronPython
> *Subject:* Re: [IronPython] PythonEngine.RunFile
>
>
>
> You can try the PythonEngine.CreateOptimizedModule which you can also pass
> a name your module should get. Let us know if that doesn't meet your needs.
>
>
>
> Martin
>
>
>
> *From:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *On Behalf Of *Tim Riley
> *Sent:* Thursday, August 10, 2006 2:17 PM
> *To:* Discussion of IronPython
> *Subject:* Re: [IronPython] PythonEngine.RunFile
>
>
>
> I've tested that and I don't think it works with:
>
> if __name___ == "__main__":
>
> in the python script.
>
> Regards,
> Tim Riley
>
> On 8/10/06, *Martin Maly* <Martin.Maly at microsoft.com> wrote:
>
>  Think PythonEngine.ExecuteFile may work for you.
>
>
>
> *From:* users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com]
> *On Behalf Of *Tim Riley
> *Sent:* Thursday, August 10, 2006 1:01 PM
> *To:* Discussion of IronPython
> *Subject:* [IronPython] PythonEngine.RunFile
>
>
>
> In IP version 0.9 there was a PythonEngine.RunFile() method, this seems to
> be gone in 1.0.6. Is there a replacement?
>
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060811/aa8ad9de/attachment.html>


More information about the Ironpython-users mailing list