<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(&quot;__main__&quot;, 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 &lt;dinov@microsoft.com&gt; wrote:<br>
&gt; I think there's a ModuleOptions flag which controls it but don't remember<br>
&gt; how to flow it in off the top of my head<br>
&gt; ________________________________<br>
&gt; From: Jeff Hardy<br>
&gt; Sent: 11/23/2011 7:31 AM<br>
&gt; To: Markus Schaber<br>
&gt; Cc: ironpython-users@python.org<br>
&gt; Subject: Re: [Ironpython-users] Setting __name__ to __main__<br>
&gt;<br>
&gt; Your best bet is to look at the source to ipy.exe, which has to do the<br>
&gt; same thing.<br>
&gt;<br>
&gt; - Jeff<br>
&gt;<br>
&gt; On Mon, Nov 21, 2011 at 9:21 AM, Markus Schaber<br>
&gt; &lt;m.schaber@3s-software.com&gt; wrote:<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; I want to set the __name__ variable to &quot;__main__&quot; in the script I execute.<br>
&gt;&gt; However, it seems that the __name__ variable always is overridden with the<br>
&gt;&gt; filename of the executed file.<br>
&gt;&gt;<br>
&gt;&gt; The attached example program gives the output &quot;name: test&quot; instead of<br>
&gt;&gt; &quot;name: __main__&quot;.<br>
&gt;&gt;<br>
&gt;&gt; Googling brought up the following issues:<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://ironpython.codeplex.com/workitem/2537">http://ironpython.codeplex.com/workitem/2537</a> - Here, they use the<br>
&gt;&gt; PythonEngine.DefaultModule API which I cannot find.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Best regards<br>
&gt;&gt;<br>
&gt;&gt; Markus Schaber<br>
&gt;&gt; --<br>
&gt;&gt; ___________________________<br>
&gt;&gt; We software Automation.<br>
&gt;&gt;<br>
&gt;&gt; 3S-Smart Software Solutions GmbH<br>
&gt;&gt; Markus Schaber | Developer<br>
&gt;&gt; Memminger Str. 151 | 87439 Kempten | Germany | Tel. &#43;49-831-54031-0 | Fax<br>
&gt;&gt; &#43;49-831-54031-50<br>
&gt;&gt;<br>
&gt;&gt; Email: m.schaber@3s-software.com | Web: <a href="http://www.3s-software.com">http://www.3s-software.com</a><br>
&gt;&gt; CoDeSys internet forum: <a href="http://forum.3s-software.com">http://forum.3s-software.com</a><br>
&gt;&gt; Download CoDeSys sample projects:<br>
&gt;&gt; <a href="http://www.3s-software.com/index.shtml?sample_projects">http://www.3s-software.com/index.shtml?sample_projects</a><br>
&gt;&gt;<br>
&gt;&gt; Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner |<br>
&gt;&gt; Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Ironpython-users mailing list<br>
&gt;&gt; Ironpython-users@python.org<br>
&gt;&gt; <a href="http://mail.python.org/mailman/listinfo/ironpython-users">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt; _______________________________________________<br>
&gt; Ironpython-users mailing list<br>
&gt; Ironpython-users@python.org<br>
&gt; <a href="http://mail.python.org/mailman/listinfo/ironpython-users">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Ironpython-users mailing list<br>
&gt; Ironpython-users@python.org<br>
&gt; <a href="http://mail.python.org/mailman/listinfo/ironpython-users">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
&gt;<br>
&gt;<br>
<br>
</div>
</span></font>
</body>
</html>