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"><<a href="mailto:sepatan@sibmail.com">sepatan@sibmail.com</a>></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'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 = "My Avalon Application"<br>
w.Content = LoadXaml("calc.xaml")<br>
calculator.enliven(w)<br>
w.Show()<br>
</div>??????????????????????????????????<br>
<div class="im"><br>
> If you use the /target:winexe with pyc.py it will add the STAThread<br>
> attribute to your main method. That should fix the exception.<br>
><br>
> In the C# console app you can add the STAThread attribute to the main<br>
> method:<br>
><br>
> class Program<br>
> {<br>
> [STAThread]<br>
> static void Main(string[] args)<br>
> {<br>
><br>
> On 19 March 2012 08:17, <<a href="mailto:sepatan@sibmail.com">sepatan@sibmail.com</a>> wrote:<br>
>> I have a need to run a WPF application written in IronPython on the<br>
>> client<br>
>> without installing IronPython.<br>
</div>>> В Technology to try to debug a standard example of WPF<br>
>> .\IronPython-2.7.2.1\Tutorial.<br>
>> В Baseline data:<br>
<div><div class="h5">>><br>
>> 1) The computer is not installed IronPython. From IronPython-2.7.2.1.zip<br>
>> (download program) extracted in C:\IronPython<br>
>><br>
>> 2) Create a C:\IronPython subdirectory pyc_d.<br>
>><br>
>> 3) In the C:\IronPython\pyc_d created a file primer.py:<br>
>><br>
>> from avalon import *<br>
>> import calculator<br>
>> w = Window()<br>
>> w.Title = "My Avalon Application"<br>
>> w.Content = LoadXaml("calc.xaml")<br>
>> calculator.enliven(w)<br>
>> w.Show()<br>
>><br>
>> 4)pyc_d contains:<br>
>><br>
>> IronPython.dll<br>
>> IronPython.Modules.dll<br>
>> IronPython.Wpf.dll<br>
>> Microsoft.Scripting.dll<br>
>><br>
>> avalon.py<br>
>> Calc.xaml<br>
>> calculator.py<br>
>> primer.py<br>
>> pyc.py<br>
>><br>
>> 5) Run ipy.exe, sequentially enter commands from the primer.py, it works<br>
>> :).<br>
>><br>
>> 6) Next:<br>
>> c:\IronPython\ipy.exe pyc.py /main:primer.py /target:exe /platform:x86<br>
>> /standalone<br>
</div></div>>> I get primer.exe (4,09 РњР‘).<br>
<div class="im">>><br>
>> 7) Run from the console, I get:<br>
>> C:\IronPython\pyc_d>primer.exe<br>
>><br>
>> An unhandled exception: System.InvalidOperationException: The calling<br>
>> thread must be STA, because many UI components require this.<br>
</div>>> В РІ<br>
>> Microsoft.Scripting.Interpreter.NewInstruction.Run(InterpretedFrame<br>
>> frame)<br>
>> В РІ Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame<br>
>> frame)<br>
>> В РІ Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0<br>
<div class="im">>> arg0, T1 arg1, T2 arg2)<br>
</div>>> В<br>
...............................................................................<br>
>> В All is not enumerate<br>
<div class="im">>><br>
>> It seems to do everything correctly. I take an example from the<br>
>> Tutorial,<br>
>> the files from the Tutorial, to be going smoothly, but ... What is the<br>
>> problem?<br>
>><br>
>> 8)Try another option. Make a thin client in C #.<br>
</div>>> В Create a console C # project, and Program.cs:<br>
<div class="im">>><br>
>> using System;<br>
>> using IronPython.Hosting;<br>
>> using Microsoft.Scripting.Hosting;<br>
>> using System.Reflection;<br>
>> using System.IO;<br>
>><br>
>> namespace ConsoleApplication1<br>
>> {<br>
>> class Program<br>
{<br>
>> static void Main(string[] args)<br>
>> {<br>
>> string path = Assembly.GetExecutingAssembly().Location;<br>
>> string dir = Directory.GetParent(path).FullName;<br>
>><br>
>> ScriptEngine engine = Python.CreateEngine();<br>
>> ScriptSource source =<br>
>> engine.CreateScriptSourceFromFile(Path.Combine(dir, args[0]));<br>
>> CompiledCode compiled = source.Compile();<br>
>> ScriptScope scope = engine.CreateScope();<br>
>> compiled.Execute(scope);<br>
>> }<br>
>> }<br>
>> }<br>
>><br>
>> 9) run:<br>
>> C:\IronPython\pyc_d>ConsoleApplication1.exe primer.py<br>
>><br>
>> the same result: (Unhandled exception: System.InvalidOperationException:<br>
>> The calling thread must be STA, because many UI components require<br>
>> this.)<br>
</div>>> В What is the problem?<br>
>> В Are there any experts who can create learning (from Tutorial) WPF<br>
<div class="im">>> application and run it on a machine without installing IronPython from<br>
>> the console?<br>
</div>>> В 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>