Airplane mode control using Python?

2013-12-22 Thread Kevin Peterson
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()'. 

One important thing is, I want to be able to do this without the need to reboot 
the Android device and any other working solution is also fine long as it is 
invokeable through Python.

Thanks,
Kevin Peterson


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Airplane mode control using Python?

2013-12-22 Thread Kevin Peterson
I will take care.

Thanks,


On Mon, Dec 23, 2013 at 10:22 AM,  wrote:

> On 12/22/2013 08:33 PM, Chris Angelico wrote:
> > On Mon, Dec 23, 2013 at 2:20 PM, Kevin Peterson 
> wrote:
> >> 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()'.
> >
> > Python code is sensitive to changes in whitespace. The above is
> > actually a syntax error, because lines have been merged and indented
> > incorrectly. You seem to be posting from Google Groups, which may be
> > why it's messed up; I recommend switching to something else, like
> > Mozilla Thunderbird, or subscribing instead to the mailing list
> > (with all the same content)
>
> My electricity went out right around the time the OP posted
> from Google Groups, that too was undoubtedly GG's fault.
>
> Come on Chris, it is just as easy to make typo or copy-and-
> paste errors in any other software as GG, there is no evidence
> that it was GG's fault.
>
> If you want to recommend the mailing list, fine, but please
> don't make stupid, unfounded, accusatory suggestions.
>
> Kevin: just for your own info, there are a few people here
> who despise Google Groups.  I and many other people post
> from Google Groups regularly and it works fine.  You might
> want to take a look at
>  https://wiki.python.org/moin/GoogleGroupsPython
> for some ways to reduce the annoyance factor for the anti-GG
> clique here.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Daemonify my python script on Android

2013-12-22 Thread Kevin Peterson
Hi,

I want to daemonify my python script on Android device. That is, it should
be automatically invoked on boot up.

Appreciate your help.

Thanks

KP
-- 
https://mail.python.org/mailman/listinfo/python-list


Deamonify my python script on Android

2013-12-23 Thread Kevin Peterson
Hi, 

I want to daemonify my python script on Android device. That is, it should be 
automatically invoked on boot up.

Appreciate your help.

Thanks,
Kevin Peterson


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Airplane mode control using Python?

2013-12-23 Thread Kevin Peterson
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 "", line 1, in 
AttributeError: 'module' object has no attribute 'Android'
>>>

Thanks,


On Mon, Dec 23, 2013 at 9:29 AM, Ned Batchelder 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
>
-- 
https://mail.python.org/mailman/listinfo/python-list


stdout of child process as an input of another thread in Python?

2015-05-29 Thread Kevin Peterson
Hi, 

I want to use the stdout of child process as an input of another thread, but 
some how I am not able to read the stdout.  Using Popen I have created a child 
process and stdout of it I have redirected to PIPE (because I don't want that 
to be printed on with my main process).  Now using this 
statement,"Line=Proc.stdout.readline()" I want to read stdout of child process 
and I have to do operation on that. but somehow i am not able to read from 
stdout of child process. 

Following is the code snapshot - 

Proc = Popen(["python.exe","filename.py"],stdout=PIPE)

while True:
Line = Proc.stdout.readline()
print Line

Here,
Filename.py(Child process) is continuously printing "Hello World!!" in place of 
reading stdout of child process. 



Thanks,
Kevin Peterson


-- 
https://mail.python.org/mailman/listinfo/python-list


How we can send mail with attachment in Python?

2015-07-19 Thread Kevin Peterson
Hi, 

How we can send mail with attachment in Python? Is it any prerequisite for it?


Thanks,
Kevin Peterson


-- 
https://mail.python.org/mailman/listinfo/python-list