Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.081 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.01; 'everyone!': 0.07; 'python3': 0.07; 'collier': 0.09; 'launchpad': 0.09; 'performs': 0.09; 'python': 0.11; 'systems.': 0.12; 'wrote:': 0.18; 'help.': 0.21; 'header:User-Agent:1': 0.23; 'subject:Code': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'unix': 0.29; 'code': 0.31; 'received:10.0.0': 0.31; 'that.': 0.31; 'prints': 0.31; 'file': 0.32; 'everyone': 0.33; 'could': 0.34; 'johnson': 0.35; 'received:google.com': 0.35; 'licensed': 0.36; 'useful': 0.36; 'received:10.0': 0.36; 'received:10': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'either': 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; 'contents.': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=v7EnPlkfPZGa6GSErbaf4NHWSD5/C+kJt0QFMXwOBMk=; b=EY6IpWsjEVYFGJq/j/RH0PHemjL7+VIzhwUL0izZrxKnTHctZcDx+yUZEbVP56WkTy 8Wm5desiF0dJwgQcIk4AdwFPdX9fD70cwCrjDK57z9f69FbIiN4HApe7lDSBrdulQl+d oxTrBWtdYSUwPLkrCTPM5t82gKhuvUvpyjwgk2QAJ6S5ThAaMsQ/3SSSd16Mi6UpJWWc 7ymhlC8jN5OIbDuOsNRMQWCPZfN3vm/B+WbeaXvEP4v9nJV2qh/ELvqkKjR6YhcQm+GR sisGwiV3Po8cToeAWTCSrGBkYm18CoTuprcVqGhBqvh96Xj6kkqqHrnU5Qf3j9WbhTSY zWAg== X-Received: by 10.236.79.7 with SMTP id h7mr31661081yhe.165.1375239908654; Tue, 30 Jul 2013 20:05:08 -0700 (PDT) Date: Tue, 30 Jul 2013 23:05:05 -0400 From: Devyn Collier Johnson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Python Mailing List Subject: Re: Share Code: Laptop Lid State References: <51F7C861.3060208@Gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375240361 news.xs4all.nl 15893 [2001:888:2000:d::a6]:42499 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51616 On 07/30/2013 12:00 PM, Chris Angelico wrote: > On Tue, Jul 30, 2013 at 3:06 PM, Devyn Collier Johnson > 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 The script returns either "open" or "close" instead of printing the whole file contents. I thought some people would find it useful (^_^;). DCJ