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


Groups > comp.lang.python > #51574

Re: Share Code: Laptop Lid State

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.047
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'everyone!': 0.07; 'python3': 0.07; 'collier': 0.09; 'launchpad': 0.09; 'performs': 0.09; 'python': 0.11; 'systems.': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'help.': 0.21; 'subject:Code': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'prints': 0.31; 'everyone': 0.33; 'could': 0.34; 'johnson': 0.35; 'received:google.com': 0.35; 'licensed': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'skip:o 30': 0.61; 'simply': 0.61; 'soon': 0.63; '30,': 0.65; 'jul': 0.74; 'account.': 0.80; 'subject:Laptop': 0.84; 'subject:State': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=lN2kMQJlVKnnTpI+DeJ7mKPOancFsJGK2hEqAWkA1yM=; b=J77Q7aHCnDWxhMRFfBfm9S1setFH5wSv7C7PbECItCGWc3uGo5LxTysgDELPjKJ84R coF11cxXXRtvsDkgMmV97Mz/WcA76A6sSbT6J2b7AeuNJyC9pXe/cz7rLLmd3W24yQGF M0LW7cMdH4MvTRh+tCT1Yc1Dd6Fq/hmyzhuppgkvT8SsQVpdEf3eQqTCtRIcCDDajMBM DYprYlO6mPNGqNvplDqB0/LDTDRVStvufEr1lj28PPJ5CEHRNfwQN3fcxR9bHCVhtrsN 8rd7x8A0fF3DzpDqOMsRvcmsEje0XSz4BfYjH13CRXJ3saO6CtHUnNCLbMHMOeWC5O1z Bhig==
MIME-Version 1.0
X-Received by 10.58.249.236 with SMTP id yx12mr27391039vec.25.1375200004094; Tue, 30 Jul 2013 09:00:04 -0700 (PDT)
In-Reply-To <51F7C861.3060208@Gmail.com>
References <51F7C861.3060208@Gmail.com>
Date Tue, 30 Jul 2013 17:00:04 +0100
Subject Re: Share Code: Laptop Lid State
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.15
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.5319.1375200012.3114.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375200012 news.xs4all.nl 15916 [2001:888:2000:d::a6]:33664
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51574

Show key headers only | View raw


On Tue, Jul 30, 2013 at 3:06 PM, Devyn Collier Johnson
<devyncjohnson@gmail.com> wrote:
> Aloha everyone!
>
>    I attached a script that I thought I could share with everyone for your
> help. This Python3 script only works on Unix systems. It prints the current
> state of the lid. This can be used to make a script that performs some
> action when the lid is closed or open. The script is licensed under LGPLv3
> and I will soon upload it to my Launchpad account. Enjoy!

There's... no Python code in that. Why not simply
open("/proc/acpi/button/lid/LID/state") and read from it, instead of
using cat and awk?

ChrisA

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


Thread

Re: Share Code: Laptop Lid State Chris Angelico <rosuav@gmail.com> - 2013-07-30 17:00 +0100

csiph-web