Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7284

Re: test_popen

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <SRS0=EpBE=Y6=ieee.org=davea@srs.perfora.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '2.7': 0.04; 'ok.': 0.04; '3.2': 0.05; '(actually': 0.09; 'disable': 0.09; 'ids': 0.09; 'module)': 0.09; 'parsing': 0.09; 'subprocess': 0.09; 'pm,': 0.10; 'wrote:': 0.14; '"0"': 0.16; 'disables': 0.16; 'lenovo,': 0.16; 'pad': 0.16; 'parsed': 0.16; 'pipe,': 0.16; 'simpler.': 0.16; 'stderr': 0.16; 'stdout': 0.16; 'sudo': 0.16; 'cc:addr:python- list': 0.17; 'generic': 0.19; 'shell': 0.19; 'command': 0.19; 'otherwise,': 0.19; 'jan': 0.20; 'header:In-Reply-To:1': 0.21; '(but': 0.22; 'modify': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'disabling': 0.23; 'worked': 0.24; 'specify': 0.25; 'function': 0.25; 'string': 0.26; '(in': 0.26; 'script': 0.27; "i'm": 0.27; 'correct': 0.28; 'thanks': 0.28; 'manually': 0.29; 'import': 0.29; 'fine.': 0.29; 'class': 0.29; 'cc:addr:python.org': 0.30; 'module': 0.30; 'cmd': 0.30; 'disabled': 0.30; 'ran': 0.30; 'looks': 0.31; 'listing': 0.31; 'print': 0.31; 'this.': 0.31; 'seem': 0.32; 'anyone': 0.32; 'done': 0.32; 'does': 0.33; 'post': 0.33; 'list': 0.33; "isn't": 0.33; '...': 0.34; "i'll": 0.34; 'question': 0.34; 'that,': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'icon': 0.35; 'couple': 0.35; 'else': 0.35; 'using': 0.35; 'test': 0.35; 'logs': 0.36; 'open': 0.36; 'device': 0.37; 'difference': 0.37; 'similar': 0.37; 'issue': 0.37; 'assuming': 0.37; 'case': 0.37; 'subject:: ': 0.38; 'received:192': 0.38; 'user': 0.39; 'should': 0.39; 'called': 0.39; 'rest': 0.39; 'missing': 0.40; 'really': 0.40; 'received:192.168.1': 0.40; 'more': 0.60; 'kind': 0.60; 'double': 0.62; 'back': 0.63; 'touch': 0.65; 'interest': 0.65; 'here': 0.66; 'today,': 0.71; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'failure': 0.73; 'clicking': 0.84; '02:59': 0.84; 'deactivated.': 0.84; 'to:addr:charter.net': 0.91; 'mouse': 0.93
Date Thu, 09 Jun 2011 06:50:36 -0400
From Dave Angel <davea@ieee.org>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10
MIME-Version 1.0
To harrismh777 <harrismh777@charter.net>
Subject Re: test_popen
References <AvYHp.2346$5v5.359@newsfe11.iad>
In-Reply-To <AvYHp.2346$5v5.359@newsfe11.iad>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:NqtSW4iu4o8hR+ixp1WvHhHFKyiENkBTCus3yhElcOh s1yeJ48/dlNF7ZIIBgmGqPrq0HOuHkLU7VA2mLF/57oLxTo0XX 1OURCyUzkjteOxsnzvUyY/FSfIAHfnc4fqA9+kyajBdCpH2hUs 4SVPernUd0Xh0YIwAk7eC9T36viKqN2LKWjuRo6w7i7y+VxcBf zEh64mr5ob0Bh9R11KhqQ==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To davea@ieee.org
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.49.1307616666.11593.python-list@python.org> (permalink)
Lines 63
NNTP-Posting-Host 82.94.164.166
X-Trace 1307616667 news.xs4all.nl 49041 [::ffff:82.94.164.166]:45320
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7284

Show key headers only | View raw


On 01/-10/-28163 02:59 PM, harrismh777 wrote:
> Looks like my 2.7 test_popen failure is an open issue7671... since Jan
> 2010. Looks like it really does function ok.
>
> At any rate, I was able to test Popen myself today, and it ran fine. I
> needed to write a script that will disable the touch pad on this HP g
> series, because there is no way to do that in the bios. So, in
> gnu/linux, you get the device id list with 'xinput list' and then to
> disable the touch pad for that id, enter this command:
>
> 'xinput set-prop <id#> "Device Enabled" 0'
>
> So, I'm using Popen class to talk to the system through a shell and read
> back the stdout through a pipe, and was able to retrieve the device ids
> with this (in ver 2.7.1) :
>
> from subprocess import PIPE, Popen
> cmd = 'xinput list'
> p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
> stdout, stderr = p.communicate()
> print stdout
>
> (actually I parsed it with the re module)
>
> The only difference here between 2.7 and 3.2 is that 3.2 gives back a
> b'string' ... otherwise, same same.
>
> I'm parsing the ids listing with the re module and then using Popen to
> issue the command to disable the touch pad. Its a little more
> complicated than that, because I only allow the script to 'work' if it
> finds the id=# for an attached mouse or track-ball... I use the Logitech
> Trackman... otherwise it asks the double question for whether the touch
> pad should be deactivated. So, clicking the icon once disables the pad,
> and clicking it again re-enables it, assuming the trackman is plugged
> in. The trick does not work across login-logout, so the touchpad must be
> disabled in the startup, or else manually every time the user logs in.
>
> When I get the silly thing done I'll post it, in case anyone else is
> interested... there does seem to be a lot of interest on the net for
> disabling the synaptics touch pad... it just gets in the way most of the
> time and isn't very efficient the rest of the time. (but I digress)
>
>
> kind regards,
> m harris
>
>



Thanks for this.  It has already helped me solve a similar problem, and 
in my case the problem/solution is much simpler.  The xinput cmd permits 
you to specify the device name directly, so for my Lenovo, I can just 
use the shell command:

sudo xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics 
TouchPad" "Device Enabled" "0"

I used the information you supplied to modify what already worked on a 
couple of Dells I had.  What I was missing was the correct string for 
the Lenovo.  The Dells called it  "PS/2 Generic Mouse"

DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

test_popen harrismh777 <harrismh777@charter.net> - 2011-06-09 00:04 -0500
  Re: test_popen Dave Angel <davea@ieee.org> - 2011-06-09 06:50 -0400

csiph-web