473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to respond to a confirmation prompt automatically

Just to give you some background about my problem:

I execute os.system(command), where command is a string.

On the command line in windows, I get:

"Continue, and unload these objects? [no]"

I need to respond 'y' to continue, but I am uncertain on how to output
the 'y' automatically.
Thanks in advance.

Jan 12 '07 #1
2 14011
"Coby" <fi********@gmail.comwrites:
Just to give you some background about my problem:

I execute os.system(command), where command is a string.

On the command line in windows, I get:

"Continue, and unload these objects? [no]"

I need to respond 'y' to continue, but I am uncertain on how to output
the 'y' automatically.
You need to use pipe.

1.

p = os.popen(command, "w")
p.write("y\n")

http://docs.python.org/lib/os-newstr...#os-newstreams

2.

from subprocess import Popen, PIPE
p = Popen(command, shell=True, stdin=PIPE)
p.stdin.write("y\n")

http://docs.python.org/lib/module-subprocess.html

--
HTH,
Rob
Jan 12 '07 #2
Thanks Rob.
Rob Wolfe wrote:
"Coby" <fi********@gmail.comwrites:
Just to give you some background about my problem:

I execute os.system(command), where command is a string.

On the command line in windows, I get:

"Continue, and unload these objects? [no]"

I need to respond 'y' to continue, but I am uncertain on how to output
the 'y' automatically.

You need to use pipe.

1.

p = os.popen(command, "w")
p.write("y\n")

http://docs.python.org/lib/os-newstr...#os-newstreams

2.

from subprocess import Popen, PIPE
p = Popen(command, shell=True, stdin=PIPE)
p.stdin.write("y\n")

http://docs.python.org/lib/module-subprocess.html

--
HTH,
Rob
Jan 12 '07 #3

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

Similar topics

2
by: Martin Herrman | last post by:
Hi all, i'm quite new to javascript and can't find the answer on the net, but sorry if i'm going to ask a stupid question :-) I am programming in PHP. The PHP code makes a message which I want...
0
by: Ron Clarke | last post by:
I have a small web app that displays data from a SQL Server database. Using a DataGrid control on a page, the user can delete a row from the database. This works fine. But I want to prompt the user...
7
by: Andy | last post by:
I have been struggling with this for a while, and have seen lots of related postings, but nothing (as far as I can see) that answers this directly. Im using vb dotnet and have an aspx that has a...
6
by: Dave | last post by:
Hello. I want to prompt user for some action with Yes/No message, I know some tricks in JavaScript, but I need to handle the user answer at server side. Exactly I want to prompt user for...
2
by: kowndinya | last post by:
Hello, Please help me. I have seen similar problem in this forum but the answer is related to something else. I have created a small program to send e-mail (MS Outlook) automatically when...
0
by: johnmott | last post by:
Hi all, One of the limitations of the GridView control is that the built-in delete processing doesn't prompt for confirmation -- something thats very important for a user interface. True, you...
1
by: sweetpotatop | last post by:
Hi, I have an asp.net project written in C# It has a list of records for users to delete and select. When user click the "Delete" button, I would like to ask the user to confirm before I...
3
by: razjafry | last post by:
Hi, I am using Access2000/2002. When we make any change in the tables most of the time it goes in effect without any confirmation which is not good as someone can by mistake make changes which get...
2
by: beemomo | last post by:
Hi everyone. I used the BeforeUpdate event procedure to display a confirmation prompt and handle a user's response to either cancel or continue with the save as described in MSDN: Private Sub...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.