Setting /target:winexe should not show any console window. Are you sure its a console window that is being shown?<div><br></div><div>Thanks,</div><div><br></div><div>slide<br><br><div class="gmail_quote">2012/3/19  <span dir="ltr">&lt;<a href="mailto:sepatan@sibmail.com">sepatan@sibmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you, Matt Ward :).<br>
 It worked :)). You&#39;re a real expert.<br>
 Just one more thing, a window appears and then disappears. I guess,<br>
because the console is closed.<br>
 Maybe after the text of the program in primer.py something else should be?<br>
<div class="im"><br>
from avalon import *<br>
import calculator<br>
w = Window()<br>
w.Title = &quot;My Avalon Application&quot;<br>
w.Content = LoadXaml(&quot;calc.xaml&quot;)<br>
calculator.enliven(w)<br>
w.Show()<br>
</div>??????????????????????????????????<br>
<div class="im"><br>
&gt; If you use the /target:winexe with pyc.py it will add the STAThread<br>
&gt; attribute to your main method. That should fix the exception.<br>
&gt;<br>
&gt; In the C# console app you can add the STAThread attribute to the main<br>
&gt; method:<br>
&gt;<br>
&gt;     class Program<br>
&gt;     {<br>
&gt;         [STAThread]<br>
&gt;         static void Main(string[] args)<br>
&gt;         {<br>
&gt;<br>
&gt; On 19 March 2012 08:17,  &lt;<a href="mailto:sepatan@sibmail.com">sepatan@sibmail.com</a>&gt; wrote:<br>
&gt;&gt; I have a need to run a WPF application written in IronPython on the<br>
&gt;&gt; client<br>
&gt;&gt; without installing IronPython.<br>
</div>&gt;&gt; В Technology to try to debug a standard example of WPF<br>
&gt;&gt; .\IronPython-2.7.2.1\Tutorial.<br>
&gt;&gt; В Baseline data:<br>
<div><div class="h5">&gt;&gt;<br>
&gt;&gt; 1) The computer is not installed IronPython. From IronPython-2.7.2.1.zip<br>
&gt;&gt; (download program) extracted in C:\IronPython<br>
&gt;&gt;<br>
&gt;&gt; 2) Create a C:\IronPython subdirectory pyc_d.<br>
&gt;&gt;<br>
&gt;&gt; 3) In the C:\IronPython\pyc_d created a file primer.py:<br>
&gt;&gt;<br>
&gt;&gt; from avalon import *<br>
&gt;&gt; import calculator<br>
&gt;&gt; w = Window()<br>
&gt;&gt; w.Title = &quot;My Avalon Application&quot;<br>
&gt;&gt; w.Content = LoadXaml(&quot;calc.xaml&quot;)<br>
&gt;&gt; calculator.enliven(w)<br>
&gt;&gt; w.Show()<br>
&gt;&gt;<br>
&gt;&gt; 4)pyc_d contains:<br>
&gt;&gt;<br>
&gt;&gt; IronPython.dll<br>
&gt;&gt; IronPython.Modules.dll<br>
&gt;&gt; IronPython.Wpf.dll<br>
&gt;&gt; Microsoft.Scripting.dll<br>
&gt;&gt;<br>
&gt;&gt; avalon.py<br>
&gt;&gt; Calc.xaml<br>
&gt;&gt; calculator.py<br>
&gt;&gt; primer.py<br>
&gt;&gt; pyc.py<br>
&gt;&gt;<br>
&gt;&gt; 5) Run ipy.exe, sequentially enter commands from the primer.py, it works<br>
&gt;&gt; :).<br>
&gt;&gt;<br>
&gt;&gt; 6) Next:<br>
&gt;&gt; c:\IronPython\ipy.exe pyc.py /main:primer.py /target:exe /platform:x86<br>
&gt;&gt; /standalone<br>
</div></div>&gt;&gt; I get primer.exe (4,09 РњР‘).<br>
<div class="im">&gt;&gt;<br>
&gt;&gt; 7) Run from the console, I get:<br>
&gt;&gt; C:\IronPython\pyc_d&gt;primer.exe<br>
&gt;&gt;<br>
&gt;&gt; An unhandled exception: System.InvalidOperationException: The calling<br>
&gt;&gt; thread must be STA, because many UI components require this.<br>
</div>&gt;&gt; В  РІ<br>
&gt;&gt; Microsoft.Scripting.Interpreter.NewInstruction.Run(InterpretedFrame<br>
&gt;&gt; frame)<br>
&gt;&gt; В  РІ Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame<br>
&gt;&gt; frame)<br>
&gt;&gt; В  РІ Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0<br>
<div class="im">&gt;&gt; arg0, T1 arg1, T2 arg2)<br>
</div>&gt;&gt; В<br>
...............................................................................<br>
&gt;&gt; В All is not enumerate<br>
<div class="im">&gt;&gt;<br>
&gt;&gt; It seems to do everything correctly. I take an example from the<br>
&gt;&gt; Tutorial,<br>
&gt;&gt; the files from the Tutorial, to be going smoothly, but ... What is the<br>
&gt;&gt; problem?<br>
&gt;&gt;<br>
&gt;&gt; 8)Try another option. Make a thin client in C #.<br>
</div>&gt;&gt; В Create a console C # project, and Program.cs:<br>
<div class="im">&gt;&gt;<br>
&gt;&gt; using System;<br>
&gt;&gt; using IronPython.Hosting;<br>
&gt;&gt; using Microsoft.Scripting.Hosting;<br>
&gt;&gt; using System.Reflection;<br>
&gt;&gt; using System.IO;<br>
&gt;&gt;<br>
&gt;&gt; namespace ConsoleApplication1<br>
&gt;&gt; {<br>
&gt;&gt;      class Program<br>
        {<br>
&gt;&gt;            static void Main(string[] args)<br>
&gt;&gt;            {<br>
&gt;&gt;                  string path = Assembly.GetExecutingAssembly().Location;<br>
&gt;&gt;                  string dir = Directory.GetParent(path).FullName;<br>
&gt;&gt;<br>
&gt;&gt;                  ScriptEngine engine = Python.CreateEngine();<br>
&gt;&gt;                  ScriptSource source =<br>
&gt;&gt; engine.CreateScriptSourceFromFile(Path.Combine(dir, args[0]));<br>
&gt;&gt;                  CompiledCode compiled = source.Compile();<br>
&gt;&gt;                  ScriptScope scope = engine.CreateScope();<br>
&gt;&gt;                  compiled.Execute(scope);<br>
&gt;&gt;           }<br>
&gt;&gt;      }<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; 9) run:<br>
&gt;&gt; C:\IronPython\pyc_d&gt;ConsoleApplication1.exe primer.py<br>
&gt;&gt;<br>
&gt;&gt; the same result: (Unhandled exception: System.InvalidOperationException:<br>
&gt;&gt; The calling thread must be STA, because many UI components require<br>
&gt;&gt; this.)<br>
</div>&gt;&gt; В What is the problem?<br>
&gt;&gt; В Are there any experts who can create learning (from Tutorial) WPF<br>
<div class="im">&gt;&gt; application and run it on a machine without installing IronPython from<br>
&gt;&gt; the console?<br>
</div>&gt;&gt; В Thank you.)<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org">Ironpython-users@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Website: <a href="http://earl-of-code.com" target="_blank">http://earl-of-code.com</a><br>
</div>