472,353 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 1105
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.