473,382 Members | 1,639 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,382 software developers and data experts.

popen and two-way communication

I'd like to use popen for a little script to call gnu privacy guard and
display decrypted text to a window.

Working from the dos prompt I can type in:

"gpg -d <filename>"

But then gpg then comes back at me with something like:

"""
You need a passphrase to unlock the secret key for
user: "xxxx <xx@somewhere.net>"
1024-bit ELG-E key, ID xxxxxx, created 2004-04-27 (main key ID xxxxxx)

Enter passphrase:
"""

After entering the passphrase the decrypted text gets dumped to the console.

How do I do this with popen?

Stephen

(Too bad the pexpect module doesn't work under windows.)
Jul 18 '05 #1
2 1265
You may be interested in the new subprocess module:

1) PEP:
http://www.python.org/dev/doc/devel/whatsnew/node8.html

2) source code:
http://www.lysator.liu.se/~astrand/popen5/

3) Windows builds (pre Python-2.4):
http://effbot.org/downloads/#subprocess

Regards

Carl

Stephen Boulet <stephendotboulet@motorola_._com> wrote in message news:<cl**********@newshost.mot.com>...
I'd like to use popen for a little script to call gnu privacy guard and
display decrypted text to a window.

Working from the dos prompt I can type in:

"gpg -d <filename>"

But then gpg then comes back at me with something like:

"""
You need a passphrase to unlock the secret key for
user: "xxxx <xx@somewhere.net>"
1024-bit ELG-E key, ID xxxxxx, created 2004-04-27 (main key ID xxxxxx)

Enter passphrase:
"""

After entering the passphrase the decrypted text gets dumped to the console.

How do I do this with popen?

Stephen

(Too bad the pexpect module doesn't work under windows.)

Jul 18 '05 #2
cmkl wrote:
You may be interested in the new subprocess module:

1) PEP:
http://www.python.org/dev/doc/devel/whatsnew/node8.html

2) source code:
http://www.lysator.liu.se/~astrand/popen5/

3) Windows builds (pre Python-2.4):
http://effbot.org/downloads/#subprocess

Regards

Carl


Thanks for the links. I hope someone writes some examples soon! ;)

Stephen
Jul 18 '05 #3

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

Similar topics

2
by: Stuart McGraw | last post by:
When I run (Python 2.3.3) this script on a MS Windows 2000 machine: import os print "1st popen..." f = os.popen ("echo " + u"\u0054\u0045\u0053\u0054.txt") print f.read () print "2nd popen..."...
6
by: Robin Siebler | last post by:
I have a bunch of command line tests that I need to automate. I've run into too many bugs with the default Win2k command shell, so I need to either purchase 4NT or handle the logic and output...
4
by: agarwalpiyush | last post by:
Hello, I am going nuts with trying to get the following to work: This is what I intend to do: I have a line in /etc/syslog.conf which I need to delete based on ip-address provided to me in a...
2
by: Maarten van Veen | last post by:
A long story made short, I've build a python/cgi website consisting of two pages. Page1 has a html form in which you can input a series of queries. Then via Popen it starts a pythons search script,...
1
by: yichun.wei | last post by:
Perl has the ability to do the following: print <<EOF; ...reams of text goes here... EOF Is there a Python equivalent of the above Perl code? This thread has previous discussion on the...
2
by: Greg Ercolano | last post by:
When I use os.popen(cmd,'w'), I find that under windows, the stdout of the child process disappears, instead of appearing in the DOS window the script is invoked from. eg: C:\type foo.py import...
3
by: Jesse | last post by:
Hi all, I have a problem using wget and Popen. I hope someone can help. -- Problem -- I want to use the command: wget -nv -O "dir/cpan.txt" "http://search.cpan.org" and capture all it's...
12
by: Eric_Dexter | last post by:
I am trying to modify a programming example and I am coming up with two problems... first is that I can't seem to pass along the arguments to the external command (I have been able to do that with...
15
by: Daniel Klein | last post by:
I'm trying to get popen to work on Windows. Here's a simplified example of what I'm trying to get working: I have a hw.c program as follows: #include <stdio.h> main() { printf ("Hello...
25
by: Jeremy Banks | last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.