473,545 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stop popup cmd window

How can I make this script run w/o seeing a cmd popup window on the
screen? The script works well, but each hour (when the task scheduler
runs it) a brief cmd window appears and then goes away. It's only on
the screen for a second or two, but it's noticable.

u = "User Name"
f = "from address"
t = "to address"

fp = os.popen("ipcon fig /all", "r")
msg = MIMEText(fp.rea d())
fp.close()

msg["Subject"] = "%s's IPconfig Report" % u
msg["From"] = f
msg["To"] = t

h = "smtp.vt.ed u"
s = smtplib.SMTP(h)
s.sendmail(f, t, msg.as_string() )
s.quit()
Jul 18 '05 #1
10 9617
On 15 Dec 2003 13:28:01 -0800, hokiegal99 wrote:
How can I make this script run w/o seeing a cmd popup window on the
screen? The script works well, but each hour (when the task scheduler
runs it) a brief cmd window appears and then goes away. It's only on
the screen for a second or two, but it's noticable.


Use a better OS? <0.5 wink>

Run it with pythonw.exe instead of python.exe.

--
One OS to rule them all, one OS to find them,
One OS to bring them all and in the darkness bind them,
In the Land of Redmond, where the Shadows lie.

www: http://dman13.dyndns.org/~dman/ jabber: dm**@dman13.dyn dns.org
Jul 18 '05 #2
> On 15 Dec 2003 13:28:01 -0800, hokiegal99 wrote:
How can I make this script run w/o seeing a cmd popup window on the
screen? The script works well, but each hour (when the task scheduler
runs it) a brief cmd window appears and then goes away. It's only on
the screen for a second or two, but it's noticable.


Use a better OS? <0.5 wink>

Run it with pythonw.exe instead of python.exe.


How can I specify pythonw.exe over python.exe? The task scheduler has
no place for this sort of thing.
Jul 18 '05 #3
ho********@hotm ail.com (hokiegal99) writes:
On 15 Dec 2003 13:28:01 -0800, hokiegal99 wrote:
> How can I make this script run w/o seeing a cmd popup window on the
> screen? The script works well, but each hour (when the task scheduler
> runs it) a brief cmd window appears and then goes away. It's only on
> the screen for a second or two, but it's noticable.


Use a better OS? <0.5 wink>

Run it with pythonw.exe instead of python.exe.


How can I specify pythonw.exe over python.exe? The task scheduler has
no place for this sort of thing.


Name the script 'myscript.pyw' instead of 'myscript.py'.

Thomas
Jul 18 '05 #4
hokiegal99 wrote:
How can I specify pythonw.exe over python.exe? The task scheduler has
no place for this sort of thing.


Give your script a .pyw extension:
[0] d:\ >ftype | grep py
Python.Compiled File=C:\Python2 3\python.exe "%1" %*
Python.File=C:\ Python23\python .exe "%1" %*
Python.NoConFil e=C:\Python23\p ythonw.exe "%1" %*

[0] d:\ >assoc | grep Python
..py=Python.Fil e
..pyc=Python.Co mpiledFile
..pyo=Python.Co mpiledFile
..pyw=Python.No ConFile

You can also give a full commandline to the scheduler, including the path to
pythonw.exe and the path to your script as the first argument.

Daniel

Jul 18 '05 #5
Thomas Heller wrote:
Name the script 'myscript.pyw' instead of 'myscript.py'.

Thomas


Thanks for the tip... that did it. I need to read up on the difference
between python.exe and pythonw.exe.

Thanks again!!!
Jul 18 '05 #6
On Tue, 16 Dec 2003 18:06:16 -0500, hokieghal99 wrote:
Thomas Heller wrote:
Name the script 'myscript.pyw' instead of 'myscript.py'.

Thomas


Thanks for the tip... that did it. I need to read up on the difference
between python.exe and pythonw.exe.


The difference is a Microsoft one. The former has stdin, stdout and
is a normal program. Microsoft dictates that on Windows such programs
must have a black window appear for the life of the program. The
latter is an "MFC" (or whatever the proper term is) program with no
stdin or stdout. On MS Windows this means that you don't get a black
box appearing, and it also means that the 'print' statement and
raw_input() function are useless. The difference is the specific
functions the C runtime calls to notify Windows of which sort of app
it is during startup. On non-Windows platforms (eg UNIX) there is no
such distinction. All (UNIX) apps have stdin and stdout, though they
aren't necessarily connected to the user in any way, but could be if
run in such a context.

HTH,
-D

--
For society, it's probably a good thing that engineers value function
over appearance. For example, you wouldn't want engineers to build
nuclear power plants that only _look_ like they would keep all the
radiation inside.
(Scott Adams - The Dilbert principle)

www: http://dman13.dyndns.org/~dman/ jabber: dm**@dman13.dyn dns.org
Jul 18 '05 #7
Derrick 'dman' Hudson wrote:
Thanks for the tip... that did it. I need to read up on the difference
between python.exe and pythonw.exe.

Same program, linked in different ways. See below.
The difference is a Microsoft one. The former has stdin, stdout and
is a normal program. Microsoft dictates that on Windows such programs
must have a black window appear for the life of the program.
Programs linked for the "console" subsystem (aka "character-mode
applications") have to be connected to a console window. If they're
not, Windows creates one for them.

(I'm pretty sure this is done by the loader and not the C runtime).
The latter is an "MFC" (or whatever the proper term is)
The "windows" subsystem.
The difference is the specific functions the C runtime calls to notify
Windows of which sort of app it is during startup.


A linker option, usually (/subsystem)

A console program may use the Windows API to disconnect from the
console, or create a window, and a window program may use the API
to create a console if it needs one (a version of pythonw that did this
if/when the application prints to sys.stderr would be quite useful, btw)

</F>


Jul 18 '05 #8
In article <ma************ *************** **********@pyth on.org>, Fredrik Lundh wrote:
A console program may use the Windows API to disconnect from the
console, or create a window, and a window program may use the API
to create a console if it needs one (a version of pythonw that did this
if/when the application prints to sys.stderr would be quite useful, btw)


Yes! Especially if it paused afterwards, so you could actually read the
error message! Speaking of which, is there any way to keep the console
window on the screen after double-clicking on a .py file so that syntax
errors don't result in a spead-reading test?

Thanks,
Dave

--
..:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g l i f e o u t o f t h e c o n t a i n e r :
Jul 18 '05 #9
Dave Benjamin <ra***@lackingt alent.com> writes:
In article <ma************ *************** **********@pyth on.org>,
Fredrik Lundh wrote:
A console program may use the Windows API to disconnect from the
console, or create a window, and a window program may use the API to
create a console if it needs one (a version of pythonw that did this
if/when the application prints to sys.stderr would be quite useful,
btw)


Yes! Especially if it paused afterwards, so you could actually read
the error message! Speaking of which, is there any way to keep the
console window on the screen after double-clicking on a .py file so
that syntax errors don't result in a spead-reading test?


Several I can think of.

- untested, but you get the idea:

try:
main()
except:
import traceback
traceback.print _exc()
raw_input()

- set the PYTHONINSPECT env variable during runtime

- or even fire up the debugger when a problem occurs:

<http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/65287>

And, by the way, py2exe 0.5 (still officially unreleased and
undocumented) created console-less programs automatically write
exceptions into a logfile.

Thomas
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
18289
by: Noozer | last post by:
When using the WebBrowser control, is it possible to cause popup windows to appear within the WebBrowser control itself instead of a new window? This is what I've written in the NewWindow2 event, but I can't figure out how to get the popup to appear in the same browser window. In this code the user is presented with "Yes", "No" or...
6
11650
by: Baffin Shea | last post by:
Dear All, I am a beginner in javascript and looking for help, I put the following script in the original.asp: function NewWindows() { window.open("abc.asp", "new") }
2
4357
by: Moon | last post by:
Seems I still haven't got the hang of all those window generating code in Javascript. I've got a page with about 15 photo thumbnails. When you click on a thumbnail a new window pops up which shows the enlarged version of said thumbnail. This works fine on all current browsers I've tested. However, in case I do not close the popup but click...
5
3953
by: Obantec Support | last post by:
Hi i leached some code and strung together a popup i need for a page with 5 help buttons. Now i could use 5 scripts and pre-load the values but i would rather get a better understanding of how to pass some extra values to 1 script. 1. <SCRIPT LANGUAGE="Javascript"><!-- function popUp(url) {
15
18705
by: | last post by:
So many websites can get around my Googlebar's popup blockers. Even Opera 8 can not stop those popups. I looked into the codes, and I can find nothing showing me how it is done. Can anyone help me find what how it is done? First go to http://www.sitepoint.com/forums/showthread.php?t=184025&page=1&pp=25 Click on Last ? on the page
4
22171
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a description and a class_id (stored in the value attribute of each option). The user will then select a class from the drop-down list. What I want...
7
3653
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses pageA.html 2. User clicks on menu link to open popup.html 3. pageA.html checks if popup.html is already open. It is not, open
1
1745
by: sachin jain | last post by:
hi all, I am facing this problem ...i av a datagrind with buttoncolumn as linkbutton. on clicking it i m opening a popup window and on this popup window i av a button on whose clickevent i m using window.opener.location.reload(); to refresh the parent window and then closing the child window. my problem starts here when parent window get...
3
1828
by: tess | last post by:
We are coding a popup window on exit of our site. We do not want this popup to occur if someone hits the back button. How do we stop this. Any hints?
3
2164
by: mark4asp | last post by:
How can I stop my Calendar control from firing the form validation events? I have a form containing several controls which have several validation controls each. One control is a TextBox where the date is entered. Connected to this is an image button which launches a popup window containing a calendar control. The selected value from the...
0
7411
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7439
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5987
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4962
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.