Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62622
| References | <abcd1234abc123ab12a0000025741000010000001052@gmail.com> <52B7B0D5.4060804@gmail.com> <l98cek$8qp$1@ger.gmane.org> |
|---|---|
| Date | 2013-12-23 18:15 +0530 |
| Subject | Re: Airplane mode control using Python? |
| From | Kevin Peterson <qh.resu01@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4552.1387802717.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Hi Ned,
I havenot named it as android.py and there are no .pyc files in my
directory.
Here is the snapshot
$ python
Python 2.7.2 (default, Jul 20 2013, 22:54:57)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import android
>>> droid = android.Android()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Android'
>>>
Thanks,
On Mon, Dec 23, 2013 at 9:29 AM, Ned Batchelder <ned@nedbatchelder.com>wrote:
> 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
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Airplane mode control using Python? Kevin Peterson <qh.resu01@gmail.com> - 2013-12-23 18:15 +0530
csiph-web