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


Groups > comp.lang.python > #62591 > unrolled thread

Re: Airplane mode control using Python?

Started byNed Batchelder <ned@nedbatchelder.com>
First post2013-12-22 22:59 -0500
Last post2013-12-22 22:59 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#62591 — Re: Airplane mode control using Python?

FromNed Batchelder <ned@nedbatchelder.com>
Date2013-12-22 22:59 -0500
SubjectRe: Airplane mode control using Python?
Message-ID<mailman.4533.1387771179.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web