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


Groups > comp.lang.python > #62591

Re: Airplane mode control using Python?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsreader4.netcologne.de!news.netcologne.de!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'syntax': 0.04; 'subject:Python': 0.06; 'attribute': 0.07; "'no": 0.09; 'formatting': 0.09; 'posting.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'try:': 0.09; 'python': 0.11; 'assume': 0.14; 'mangled': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'library': 0.18; 'trying': 0.19; 'else,': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'received:comcast.net': 0.24; "i've": 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; 'errors': 0.30; 'kevin': 0.30; 'mode': 0.30; 'work.': 0.31; 'code': 0.31; 'getting': 0.31; 'directory,': 0.31; 'peterson': 0.31; 'file': 0.32; 'running': 0.33; 'guess': 0.33; 'skip:# 10': 0.33; 'skip:d 20': 0.34; 'something': 0.35; 'really': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'should': 0.36; 'error.': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'reported': 0.39; 'delete': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; "you're": 0.61; 'name': 0.63; 'such': 0.63; 'sample': 0.67; 'obvious': 0.74; 'widespread': 0.91; 'online,': 0.96
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: Airplane mode control using Python?
Date Sun, 22 Dec 2013 22:59:27 -0500
References <abcd1234abc123ab12a0000025741000010000001052@gmail.com> <52B7B0D5.4060804@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host c-50-133-228-126.hsd1.ma.comcast.net
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To <52B7B0D5.4060804@gmail.com>
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4533.1387771179.18130.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387771179 news.xs4all.nl 2914 [2001:888:2000:d::a6]:57200
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62591

Show key headers only | View raw


On 12/22/13 10:41 PM, Michael Torrie wrote:
> On 12/22/2013 08:20 PM, Kevin Peterson wrote:
>> Hi,
>>
>> I am trying to control Aeroplane mode on Android using Python code.
>> I am running QPyPlus python. When I execute this code(that is widespread
>> in the net),
>>
>>      #!/usr/bin/python
>>      import android droid = android.Android()
>>      # go to airplane mode
>>       droid.toggleAirplaneMode()
>>
>>      droid.makeToast('exiting')
>>
>> I get the error 'no such attribute Android()'.
>
> Is that really how your code is formatted? The import line is an error.
>
> try:
>
> import android
>
>
> droid = android.Android()
>

The OP reported an error of "no such attribute Android", it's pretty 
obvious that he isn't getting a syntax error.  We can assume the code 
has been mangled in the posting.

Your code sample (once the obvious formatting errors have been fixed) is 
identical to ones I've found online, so I assume it should work.

My best guess is that you have named your own file android.py, shadowing 
the library you're trying to import.  Name it something else, delete all 
the *.pyc files in your directory, and try again.

-- 
Ned Batchelder, http://nedbatchelder.com

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


Thread

Re: Airplane mode control using Python? Ned Batchelder <ned@nedbatchelder.com> - 2013-12-22 22:59 -0500

csiph-web