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


Groups > comp.lang.python > #7272

test_popen

From harrismh777 <harrismh777@charter.net>
Newsgroups comp.lang.python
Subject test_popen
Message-ID <AvYHp.2346$5v5.359@newsfe11.iad> (permalink)
Date 2011-06-09 00:04 -0500

Show all headers | View raw


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



Back to comp.lang.python | Previous | NextNext 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