<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div>
<div style="font-family:Calibri,sans-serif; font-size:11pt">That's the 1.1 way of doing it, the 2.x way is probably hanging off of PythonCompilerOptions (I'd look it up but I'm on my phone).<br>
</div>
</div>
<hr>
<span style="font-family:Tahoma,sans-serif; font-size:10pt; font-weight:bold">From:
</span><span style="font-family:Tahoma,sans-serif; font-size:10pt">Doug Blank</span><br>
<span style="font-family:Tahoma,sans-serif; font-size:10pt; font-weight:bold">Sent:
</span><span style="font-family:Tahoma,sans-serif; font-size:10pt">11/23/2011 10:47 AM</span><br>
<span style="font-family:Tahoma,sans-serif; font-size:10pt; font-weight:bold">To:
</span><span style="font-family:Tahoma,sans-serif; font-size:10pt">Dino Viehland</span><br>
<span style="font-family:Tahoma,sans-serif; font-size:10pt; font-weight:bold">Cc:
</span><span style="font-family:Tahoma,sans-serif; font-size:10pt">Jeff Hardy; Markus Schaber; ironpython-users@python.org</span><br>
<span style="font-family:Tahoma,sans-serif; font-size:10pt; font-weight:bold">Subject:
</span><span style="font-family:Tahoma,sans-serif; font-size:10pt">Re: [Ironpython-users] Setting __name__ to __main__</span><br>
<br>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Perhaps this is what you are thinking of:<br>
<br>
PythonEngine engine = new PythonEngine(pyEngineOptions);<br>
engine.DefaultModule = engine.CreateModule("__main__", true);<br>
From:<br>
<br>
<a href="http://ironpython.codeplex.com/workitem/2537">http://ironpython.codeplex.com/workitem/2537</a><br>
<br>
-Doug<br>
<br>
<br>
On Wed, Nov 23, 2011 at 1:13 PM, Dino Viehland <dinov@microsoft.com> wrote:<br>
> I think there's a ModuleOptions flag which controls it but don't remember<br>
> how to flow it in off the top of my head<br>
> ________________________________<br>
> From: Jeff Hardy<br>
> Sent: 11/23/2011 7:31 AM<br>
> To: Markus Schaber<br>
> Cc: ironpython-users@python.org<br>
> Subject: Re: [Ironpython-users] Setting __name__ to __main__<br>
><br>
> Your best bet is to look at the source to ipy.exe, which has to do the<br>
> same thing.<br>
><br>
> - Jeff<br>
><br>
> On Mon, Nov 21, 2011 at 9:21 AM, Markus Schaber<br>
> <m.schaber@3s-software.com> wrote:<br>
>> Hi,<br>
>><br>
>> I want to set the __name__ variable to "__main__" in the script I execute.<br>
>> However, it seems that the __name__ variable always is overridden with the<br>
>> filename of the executed file.<br>
>><br>
>> The attached example program gives the output "name: test" instead of<br>
>> "name: __main__".<br>
>><br>
>> Googling brought up the following issues:<br>
>><br>
>> <a href="http://ironpython.codeplex.com/workitem/2537">http://ironpython.codeplex.com/workitem/2537</a> - Here, they use the<br>
>> PythonEngine.DefaultModule API which I cannot find.<br>
>><br>
>><br>
>> Best regards<br>
>><br>
>> Markus Schaber<br>
>> --<br>
>> ___________________________<br>
>> We software Automation.<br>
>><br>
>> 3S-Smart Software Solutions GmbH<br>
>> Markus Schaber | Developer<br>
>> Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax<br>
>> +49-831-54031-50<br>
>><br>
>> Email: m.schaber@3s-software.com | Web: <a href="http://www.3s-software.com">http://www.3s-software.com</a><br>
>> CoDeSys internet forum: <a href="http://forum.3s-software.com">http://forum.3s-software.com</a><br>
>> Download CoDeSys sample projects:<br>
>> <a href="http://www.3s-software.com/index.shtml?sample_projects">http://www.3s-software.com/index.shtml?sample_projects</a><br>
>><br>
>> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner |<br>
>> Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Ironpython-users mailing list<br>
>> Ironpython-users@python.org<br>
>> <a href="http://mail.python.org/mailman/listinfo/ironpython-users">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
>><br>
>><br>
> _______________________________________________<br>
> Ironpython-users mailing list<br>
> Ironpython-users@python.org<br>
> <a href="http://mail.python.org/mailman/listinfo/ironpython-users">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
><br>
><br>
> _______________________________________________<br>
> Ironpython-users mailing list<br>
> Ironpython-users@python.org<br>
> <a href="http://mail.python.org/mailman/listinfo/ironpython-users">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
><br>
><br>
<br>
</div>
</span></font>
</body>
</html>