Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2469
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:Sending': 0.07; 'python': 0.07; '>>>>': 0.09; 'subprocess': 0.09; 'sun,': 0.09; 'looked': 0.10; 'am,': 0.14; 'wrote:': 0.14; 'attribute:': 0.16; 'emits': 0.16; 'keystrokes': 0.16; 'stdin': 0.16; 'subject:exe': 0.16; 'idle': 0.19; 'appear': 0.19; 'appropriate': 0.21; 'variable': 0.21; 'header:In-Reply-To:1': 0.22; 'vista': 0.25; 'windows': 0.26; 'chris': 0.27; 'van': 0.27; 'message- id:@mail.gmail.com': 0.28; 'string': 0.29; 'process,': 0.29; 'subject:Windows': 0.29; 'work:': 0.29; 'stops': 0.31; 'does': 0.31; 'import': 0.32; 'to:addr:python-list': 0.32; "i've": 0.33; 'alex': 0.35; 'module.': 0.35; 'think': 0.36; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'takes': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'become': 0.70; 'dead.': 0.84; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84; 'running,': 0.91; 'skip:d 50': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=iDLAW0HmPEaJOnIPlkjHjQMeP4xxmXMohFpGE4klx1M=; b=SHd0+qfHB0RcbLZqs4ZlpM2Pi4tH6ePPunE8I5Tdcd5h5e1t1i+mLE+ZvdMfHBjUxM yTBUv6PB7fGlLGBBxL/nb47zJu0ykX/jy5h15zQbkHOHC0MfBa/zZbWYsw1HObenBprO 9k4RAIkxNsPBXQSxK/sNa5ml77+jMfyILK34E= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=wzurc42XPj4oiXg2QKvtkkmzbgiZB8MF7kGNKoz1TmWduUOnqG1jLPxFsEn4DTRK6c gx3JSALKyc9pLMmpwP01mRZigfT4qFDnSxtPaTGz3h3Q/0hLk+coOhyUwNt5tblvsy7y OLOg52E+HFl38zzeX14g/0ktHaADLSE+8m0Bg= |
| MIME-Version | 1.0 |
| In-Reply-To | <4d97536c$0$81483$e4fe514c@news.xs4all.nl> |
| References | <4d97536c$0$81483$e4fe514c@news.xs4all.nl> |
| Date | Sun, 3 Apr 2011 05:52:39 +1000 |
| Subject | Re: Sending keystrokes to Windows exe programs |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.139.1301773961.2990.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1301773962 news.xs4all.nl 81483 [::ffff:82.94.164.166]:59974 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2469 |
Show key headers only | View raw
On Sun, Apr 3, 2011 at 2:48 AM, Alex van der Spek <zdoor@xs4all.nl> wrote:
> I can start a windows program on Vista with:
>
>>>> import subprocess
>>>> dva=subprocess.Popen(DVAname,stdin=subprocess.PIPE)
>
> Unfortunately sending keystrokes with communicate() does not appear to work:
>
>>>> dva.communicate('F2')
>
> this does not produce any result but it does make IDLE become really idle.
I've just looked over the Python subprocess module. Is your subprocess
(named by the variable DVAname) one which takes key names on STDIN and
emits the appropriate keys?
dva.communicate('F2') will send the two-character string "F2" to the
STDIN of the process, and then wait for process termination. That's
why IDLE stops dead. If you want to send it a string and then keep
running, I think you want to use the stdin attribute:
dva.stdin.write('F2')
Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Sending keystrokes to Windows exe programs "Alex van der Spek" <zdoor@xs4all.nl> - 2011-04-02 18:48 +0200 Re: Sending keystrokes to Windows exe programs Chris Angelico <rosuav@gmail.com> - 2011-04-03 05:42 +1000 Re: Sending keystrokes to Windows exe programs Chris Angelico <rosuav@gmail.com> - 2011-04-03 05:52 +1000
csiph-web