How to hide the console window?

147 views
Skip to first unread message

Iceberg

unread,
Mar 21, 2009, 11:44:41 PM3/21/09
to web2py Web Framework
Hi pals,

I am using web2py 's windows distribution. Is there some way to hide
the console window (a.k.a. the black dos window) in which web2py is
running? I already know about:
web2py.exe -a blah -t
can start web2py in the systray of Microsoft Windows system, but the
console itself is still there and it is somewhat annoying and
meaningless to end users.

I heard this can be done if using source code, just rename the main
web2py.py to web2py.pyw, on Windows platform.

And this can also be done if using py2exe to build windows
distribution package, like this:
http://ubuntuforums.org/showthread.php?t=728170

But I don't know how things go in current web2py world. Can we just
have a web2py.exe as current situation, and one more web2pyw.exe that
does not have a console window?

Thanks for any hint.

Regards,
Iceberg

Boris Manojlovic

unread,
Mar 22, 2009, 12:13:31 AM3/22/09
to web...@googlegroups.com
Hi Iceberg,

please try hstart program as it is created just for "problems" like yours.
http://www.ntwind.com/software/utilities/hstart.html

hope it helps :)
--
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."-Albert Einstein

Iceberg

unread,
Mar 22, 2009, 8:57:12 AM3/22/09
to web2py Web Framework
Hi Boris,

Thanks for the hint. I managed to use hstart to execute "web2py.exe -a
blah -t", so it can basically satisfied my need.

However, because hstart is not fully "free" (please refer to
http://www.ntwind.com/software/utilities/hstart/distribution.html ),
so I still believe if web2py.exe has a native ability to hide the
console window.


To Massimo:

Don't know whether that is hard for web2py side.

Besides, actually what I am doing in recent days, is finding a way to
easily build ANY web2py application into a standalone setup.exe for
Windows platform, so novice can just install it, run it, and later
stop it and uninstall it in the usual way. The setup.exe itself, is
based on the famous and free installer named InnoSetup. Right now
everything is almost perfect, except that web2py.exe of the end
package has a console window by default. Hstart.exe is great and
really helps, but users need to get permission for that at first.

On Mar22, 12:13pm, Boris Manojlovic <boris.manojlo...@gmail.com>
wrote:
> Hi Iceberg,
>
> please try hstart program as it is created just for "problems" like yours.http://www.ntwind.com/software/utilities/hstart.html

mdipierro

unread,
Mar 22, 2009, 11:06:53 AM3/22/09
to web2py Web Framework
try

web2py -a blah -p 8000

Not sure.

Iceberg

unread,
Mar 22, 2009, 11:52:37 AM3/22/09
to web2py Web Framework
Tried but that does not help. :-P

We need something similar to the effect of hstart.exe's:
hstart /NOCONSOLE "web2py.exe -i 0.0.0.0 -a ""<recycle>"" -t"

cjparsons

unread,
Mar 23, 2009, 5:12:13 AM3/23/09
to web2py Web Framework
I have renamed web2py.py to web2py.pyw and then start web2py using a
shortcut with target set to
<path>\web2py.pyw -t
You need to have .pyw appropriately set up as a file type in windows
explorer for this to work I think. I had installed a windows
distribution of Python before I had web2py, and I the installation
process set this up.

The extra 'w' on the Python file extension means 'don't open a console
window'

Chris
> > > Iceberg- Hide quoted text -
>
> - Show quoted text -

Iceberg

unread,
Mar 23, 2009, 8:03:58 AM3/23/09
to web2py Web Framework
Thanks Chris but that is not the case. I already know the py and pyw
difference but that only works when you have python distribution
installed on the target PC. What I am talking about is trying to
achieve same pyw effect on a PC with no python available but only
web2py_win package is installed. Thanks anyway.

Fran

unread,
Mar 23, 2009, 5:20:52 PM3/23/09
to web2py Web Framework
On Mar 22, 3:44 am, Iceberg <iceb...@21cn.com> wrote:
> I am using web2py 's windows distribution. Is there some way to hide
> the console window (a.k.a. the black dos window) in which web2py is
> running?

I run as a service using:
http://mdp.cti.depaul.edu/AlterEgo/default/show/77

I get no console window.

PS This thread may also be useful:
http://groups.google.com/group/web2py/browse_thread/thread/733896d0aec07d3e

F

Iceberg

unread,
Mar 23, 2009, 9:00:14 PM3/23/09
to web2py Web Framework
> PS This thread may also be useful:http://groups.google.com/group/web2py/browse_thread/thread/733896d0ae...
>
> F

Hi Fran,

Actually I had read your first link, and then I was the person who
posted your second link. :-)

Running web2py as a service is a usual answer for the "no-console"
need. But somehow that can only be done when using web2py's source
code distribution (and therefore python is a precondition on the
target PC, perhaps pywin32 too).

I am seeking a way to do the same thing with web2py_win.zip binary
distribution, so that eventually any MS Windows user do not need to
install anything else, but just use web2py like every other "normal"
windows programs.

The goal is almost achieved now, with the help of "Hidden Start". I
even write a mail to Massimo for suggesting him to try to apply a free
permission of using "Hidden Start" in web2py, because of its license
policy: http://www.ntwind.com/software/utilities/hstart/distribution.html

Regards,
Iceberg

Iceberg

unread,
Mar 29, 2009, 4:46:57 AM3/29/09
to web2py Web Framework
Hi Massimo,

I spend some time on py2exe and web2py then have some proof-of-concept
conclusion here.

1. web2py is using py2exe now, so it is easy for web2py to have an
official "no-console" edition of web2py.exe.

2. Even better, we can build a traditional web2py.exe and a new web2py-
no-console.exe in one run. Just replace the last line of setup_exe.py
into this one:

setup(console=APP,
windows=[{'script':'web2py.py','dest_base':'web2py_no_console'}],
# Add this line
data_files=DATA_FILES)

3. So "web2py-no-console.exe -a blah -t" can start web2py in
background on Windows platform. And it has no technical or legal
dependence of 3rd party tool such as hstart.exe.


Please do consider adopting this approach and release web2py-no-
console.exe (or similar name) together with web2py.exe in next
web2py_win.zip. I will change my "Inno Plugin" to use web2py-no-
console.exe instead of hstart.exe. Only then, developers can freely
generate and distribute stand alone web2py app setup.exe. Thanks!

Sincerely,
Iceberg, 2009-Mar-29, 14:19(PM), Sun




On Mar22, 8:57pm, Iceberg <iceb...@21cn.com> wrote:
> Hi Boris,
>
> Thanks for the hint. I managed to use hstart to execute "web2py.exe -a
> blah -t", so it can basically satisfied my need.
>
> However, because hstart is not fully "free" (please refer tohttp://www.ntwind.com/software/utilities/hstart/distribution.html),
> so I still believe if web2py.exe has a native ability to hide the
> console window.
>
>

Michal Jursa

unread,
Mar 29, 2009, 5:38:29 AM3/29/09
to web...@googlegroups.com
Hi,
last night i found there is no possibility to force DAL to create an
index on some column. Sometimes it is necessary to select records not
only by primary key and in that case index built on some other column
should do the work better than full scans on database.

So I suggest to implement new feature to SQLField like index = True,
False is fine as default i think.

I will try to implement this myslef, but got no time this week,
finishing some project. So take the time to discuss what do you thing
about such option?

Michal alias Plysak

Reply all
Reply to author
Forward
0 new messages