469,366 Members | 2,243 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

I like python.

I'm not a coder.. I'm just a person that trys to do things with
languages he likes. Sometimes I'm successful, mostly not. I do know
that before I bother a list with a silly question I should do my best
to research for an answer myself. ala RTFM. That said my searches
haven't found me what I am looking.. lack of a decent keyword
sequence.. anywho..

Could someone please tell me what I need to put into a python script
to not have a window come up however briefly? Like when I double click
on the script, it will do it's job but won't open a command window
then close it.. I hope that explains what I'm looking for. If I see
the line I can figure out by syntax where it should go. I'm really
good at learning the gist of languages by syntax. Thank you all for
your time
Peace
--
Fidel
Oct 20 '06 #1
8 1057
MC
Hi!

Sorry, I don't understand well english.
But, try to rename your script, from .py to .pyw (sample : titi.py ==>
titi.pyw).

--
@-salutations

Michel Claveau
Oct 20 '06 #2
Renaming the file doesn't work. I am on windows... There is a specific
line of code that tells python not to bother even opening a window. of
any sort for any amount of time. I just don't know what it is and
haven't been able to find any reference to it.... Thanks for the help
though.
>assuming Windows, and assuming that you have a standard Python install for
Windows: use "pyw" instead of "py" as the script's extension.

(Windows applications come in two flavours: console applications and window
applications. the default executable for "py" files is "python.exe",
which is a con-
>sole application. "pyw" uses "pythonw.exe" instead, which is exactly the same
program, but linked as a window application instead).

</F>


On 10/20/06, MC <XX*****@xx.xmclaveaux.comwrote:
Hi!

Sorry, I don't understand well english.
But, try to rename your script, from .py to .pyw (sample : titi.py ==>
titi.pyw).

--
@-salutations

Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list

--
Fidel
Oct 20 '06 #3
Fidel wrote:
Renaming the file doesn't work. I am on windows...
Are you sure? Double-clicking on a *.pyw script file really brings up
a window? Is it a GUI window or a console window? I ask because if
it's a console window and you're really clicking on a .pyw file then it
really should run without opening the console window. If not then
there might be some problem with your python installation. But it's
much more likely that you, say, copied the script and renamed the copy
but then accidentally clicked on the old script.
There is a specific
line of code that tells python not to bother even opening a window. of
How do you know this?
Peace,
~Simon

Oct 20 '06 #4
On Oct 20, 2:59 am, Fidel <fidel.andr...@gmail.comwrote:
Could someone please tell me what I need to put into a python script
to not have a window come up however briefly? Like when I double click
on the script, it will do it's job but won't open a command window
then close it.. I hope that explains what I'm looking for. If I see
the line I can figure out by syntax where it should go. I'm really
good at learning the gist of languages by syntax. Thank you all for
your time
Are you running any external commands by using os.system() or
os.exec()? If you are running a program that is a console program
(i.e. copy, move, del, etc...) then it will open up a command window to
run it. If that is the case, then you can try using the os.popen()
utility instead.

--
Jerry

Oct 20 '06 #5
Ant

Fidel wrote:
Renaming the file doesn't work. I am on windows... There is a specific
line of code that tells python not to bother even opening a window.
Seriously, renaming the script to .pyw should work from a standard
python install. If it doesn't then the file handler for that extension
must have got messed up somewhere along the way. You can fix this by
right-clicking the renamed (*.pyw) file and selecting "open with..." ->
"Choose Program" and finding the pythonw.exe.

Oct 20 '06 #6
Although I just noticed that if the extension is .py then it will
still open a command window. It does indeed need to have a .pyw
extension for this to work. So all of you were correct. it needs to
use popen and have .pyw as the extension in order for python not to
open a command window. Thank you all for you help and support.

On 20 Oct 2006 14:28:23 -0700, Ant <an****@gmail.comwrote:
>
Fidel wrote:
Renaming the file doesn't work. I am on windows... There is a specific
line of code that tells python not to bother even opening a window.

Seriously, renaming the script to .pyw should work from a standard
python install. If it doesn't then the file handler for that extension
must have got messed up somewhere along the way. You can fix this by
right-clicking the renamed (*.pyw) file and selecting "open with..." ->
"Choose Program" and finding the pythonw.exe.

--
http://mail.python.org/mailman/listinfo/python-list

--
Fidel
Oct 20 '06 #7
Thank you Jerry. That was exactly what I was looking for. The script
in fact does call an external program and give it a command from a
randomized list. Specifically it is a random wallpaper setter using
the windows version of bsetroot. script scans a directory, creates a
list of viable walls and tells bsetroot to set the wallpaper. Using
popen instead of system did the trick handily. I thank you verily.

On 20 Oct 2006 14:21:59 -0700, Jerry <jw****@gmail.comwrote:
On Oct 20, 2:59 am, Fidel <fidel.andr...@gmail.comwrote:
Could someone please tell me what I need to put into a python script
to not have a window come up however briefly? Like when I double click
on the script, it will do it's job but won't open a command window
then close it.. I hope that explains what I'm looking for. If I see
the line I can figure out by syntax where it should go. I'm really
good at learning the gist of languages by syntax. Thank you all for
your time

Are you running any external commands by using os.system() or
os.exec()? If you are running a program that is a console program
(i.e. copy, move, del, etc...) then it will open up a command window to
run it. If that is the case, then you can try using the os.popen()
utility instead.

--
Jerry

--
http://mail.python.org/mailman/listinfo/python-list

--
Fidel
Oct 21 '06 #8
Glad I could help.

--
Jerry

Oct 25 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.