Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'interpreter': 0.05; 'everyone!': 0.07; 'python3': 0.07; 'bash': 0.09; 'collier': 0.09; 'launchpad': 0.09; 'performs': 0.09; 'pointless': 0.09; 'python': 0.11; 'systems.': 0.12; 'wrote:': 0.18; 'help.': 0.21; 'email addr:gmail.com>': 0.22; 'python?': 0.22; 'subject:Code': 0.24; 'script': 0.25; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'prints': 0.31; 'everyone': 0.33; 'trouble': 0.34; 'could': 0.34; 'johnson': 0.35; 'received:google.com': 0.35; 'licensed': 0.36; 'starting': 0.37; '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; 'kind': 0.63; '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=Go6td/NCqqcyQi70IP2jhOwi+D1iYWnMmq6mqJDuU4Q=; b=AnTnzomxxUf0olVGPz7vEmtNvccAkOyDazKmtIvKpR1jrisJQxQP+R8HHYP4isGGsk MegPjCBHUlmSrAZ1sNqUG6ndfvmCZxLnI+dE8xgLdwuMh7fNcwifpbT1fQnXvenl0D3K K7FccpPVq+sIJefN2JTf6+r7a8ajHYWdb2ookv/09Hd+fBWDJL7kgV5fnyzchbhKgVsy b6Ow9xPkAC76MZwhEPpOo7d4M1QJ2fSGBpJ5IBM8xpfFQ1BGehVvLvm9PxWFRPcWUN3E XLWM59h302/u1pZPS5SdmQUoMr275mfii36O2FG9xMBpTKeV8RBnhwfwJ+/7Ah/XgOje 4G1g== MIME-Version: 1.0 X-Received: by 10.68.101.225 with SMTP id fj1mr21777452pbb.8.1375208075300; Tue, 30 Jul 2013 11:14:35 -0700 (PDT) In-Reply-To: References: <51F7C861.3060208@Gmail.com> Date: Tue, 30 Jul 2013 12:14:35 -0600 Subject: Re: Share Code: Laptop Lid State From: Ian Kelly To: Python Content-Type: multipart/alternative; boundary=047d7b673288d2151404e2be9485 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: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375208084 news.xs4all.nl 15997 [2001:888:2000:d::a6]:43990 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51592 --047d7b673288d2151404e2be9485 Content-Type: text/plain; charset=ISO-8859-1 On Jul 30, 2013 10:06 AM, "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? Or for that matter, why not just make it a bash script instead of Python? It's kind of pointless to go to all the trouble of starting a Python interpreter just to have it start a subprocess. --047d7b673288d2151404e2be9485 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Jul 30, 2013 10:06 AM, "Chris Angelico" <rosuav@gmail.com> wrote:
>
> On Tue, Jul 30, 2013 at 3:06 PM, Devyn Collier Johnson
> <devyncjohnson@gmail.com= > wrote:
> > Aloha everyone!
> >
> > =A0 =A0I attached a script that I thought I could share with ever= yone for your
> > help. This Python3 script only works on Unix systems. It prints t= he 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 und= er 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, in= stead of
> using cat and awk?

Or for that matter, why not just make it a bash script inste= ad of Python? It's kind of pointless to go to all the trouble of starti= ng a Python interpreter just to have it start a subprocess.

--047d7b673288d2151404e2be9485--