[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Run Python app at startup

Robert Pofuk

3/2/2008 9:38:00 PM

Hy.
I create simple application. Yust an windows and "compile" it with
py2exe. I add registry value
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
MyApp /t REG_SZ /d C:\myapp.exe /f'

And it wont start. When i use console instead od window in py2exe i get
console opend but it closes.

Program:
<code prog.py>
import os
import wx

app = wx.App()
frame = wx.Frame(None, -1, "MyFrame")
frame.Show()

app.MainLoop()
</code>

Then in commang prompt:

python.exe setup.py py2exe


<code of setup.py>
from distutils.core import setup
import py2exe

setup(console=['prog.py'])
</code>

Help please!


4 Answers

dave_mikesell

3/3/2008 12:23:00 AM

0

On Mar 2, 3:37 pm, "SMALLp" <po...@email.t-com.hr> wrote:
> Hy.
> I create simple application. Yust an windows and "compile" it with
> py2exe. I add registry value
> reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
> MyApp /t REG_SZ /d C:\myapp.exe /f'
>
> And it wont start. When i use console instead od window in py2exe i get
> console opend but it closes.
>
> Program:
> <code prog.py>
> import os
> import wx
>
> app = wx.App()
> frame = wx.Frame(None, -1, "MyFrame")
> frame.Show()
>
> app.MainLoop()
> </code>
>
> Then in commang prompt:
>
> python.exe setup.py py2exe
>
> <code of setup.py>
> from distutils.core import setup
> import py2exe
>
> setup(console=['prog.py'])
> </code>

Don't you have to include the wxPython code somehow, perhaps on the
command line when building the exe?

Gabriel Genellina

3/3/2008 7:15:00 AM

0

En Sun, 02 Mar 2008 19:37:35 -0200, SMALLp <pofuk@email.t-com.hr> escribi�:

> Hy.
> I create simple application. Yust an windows and "compile" it with
> py2exe. I add registry value
> reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
> /v
> MyApp /t REG_SZ /d C:\myapp.exe /f'
>
> And it wont start. When i use console instead od window in py2exe i get
> console opend but it closes.

I'd check in this order:

python prog.py
Then, use console=... in setup.py, generate prog.exe
Open a cmd window and execute prog.exe (from the dist directory)
Repeat using window=... in setup.py

That whole sequence works fine using on my WinXP SP2 + Python 2.5.1
+ wxPython 2.8.7.1

--
Gabriel Genellina

Robert Pofuk

3/4/2008 6:36:00 PM

0

Gabriel Genellina wrote:
> En Sun, 02 Mar 2008 19:37:35 -0200, SMALLp <pofuk@email.t-com.hr> escribi�:
>
>> Hy.
>> I create simple application. Yust an windows and "compile" it with
>> py2exe. I add registry value
>> reg add
>> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
>> MyApp /t REG_SZ /d C:\myapp.exe /f'
>>
>> And it wont start. When i use console instead od window in py2exe i get
>> console opend but it closes.
>
> I'd check in this order:
>
> python prog.py
> Then, use console=... in setup.py, generate prog.exe
> Open a cmd window and execute prog.exe (from the dist directory)
> Repeat using window=... in setup.py
>
> That whole sequence works fine using on my WinXP SP2 + Python 2.5.1 +
> wxPython 2.8.7.1
>
Program works fine. When i run it it works. Problem is how to make this
aplication start at windows startup. It opens and it closes in my case.

Gabriel Genellina

3/5/2008 3:18:00 AM

0

En Tue, 04 Mar 2008 16:36:03 -0200, SMALLp <pofuk@email.t-com.hr> escribió:

>>> I create simple application. Yust an windows and "compile" it with
>>> py2exe. I add registry value
>>> reg add
>>> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
>>> MyApp /t REG_SZ /d C:\myapp.exe /f'

> Program works fine. When i run it it works. Problem is how to make this
> aplication start at windows startup. It opens and it closes in my case.

Redirect stdout and stderr to some log file so you can inspect it and see
the error:

cmd /c c:\path\myapp.exe >c:\path\output.log 2>&1

--
Gabriel Genellina