Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Executing my own Python scripts in Android using Eclipse
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Archana r  
View profile  
 More options Sep 28 2012, 5:45 am
From: Archana r <ramalingam.arch...@gmail.com>
Date: Fri, 28 Sep 2012 12:45:31 +0300
Local: Fri, Sep 28 2012 5:45 am
Subject: Re: [Py4A] Re: Executing my own Python scripts in Android using Eclipse

Hi,

In case1, where the file will be stored? How will I be able to access the
result? I actually want to write the result to internal memory. Can you
please guide me?

Thank you!

On Thu, Sep 27, 2012 at 2:29 PM, Anthony Prieur <anthony.pri...@gmail.com>wrote:

> 1)  You could dump the result in a file after the toast:

> f = open("myfile", "wb")
> f.write(str(average))
> f.close()

> You can use also pickle module to dump more complex data structure:
> http://docs.python.org/library/pickle.html

> 2) You can dump the result in a database:
> http://docs.python.org/library/sqlite3.html

> 3) you can post the result to the SL4A server, using you own facade to
> manage it:
> https://code.google.com/p/android-python27/wiki/TutorialHowToCreateCu...

> I would use 3)

> On Thu, Sep 27, 2012 at 1:12 PM, Archana <ramalingam.arch...@gmail.com>
> wrote:
> > My script is like:

> > import android

> > droid = android.Android()

> > score1 = 10

> > score2 = 20

> > average = (score1 + score2)/2

> > droid.makeToast('Result is: ' +str(average))

> > Can I get the value of average and store it in a file(in internal
> memory)?
> > Please let me know if it is possible to do it?

> > On Thursday, September 27, 2012 12:29:55 PM UTC+3, Archana wrote:

> >> Hi Anthony,

> >> Can I write the output of my script to a new file(in phone's internal
> >> memory)? Basically, I need to get the result from the script(like simple
> >> calculation). Can you also let me know of more sample Python scripts?

> >> Thank you!

> >> On Wednesday, September 26, 2012 3:33:59 PM UTC+3, Archana wrote:

> >>> Ya am able to see the print statements. Thanks for the clarification.
>  I
> >>> want to post the updated JSON(after script execution) to a server. Now
> I m
> >>> calling ScriptActivity from my ownActivity using
> startActivityForResult().
> >>> Can I define post method in onActivityResult() in my own activity?

> >>> On Wed, Sep 26, 2012 at 3:13 PM, Anthony Prieur
> >>> <anthony.pri...@gmail.com> wrote:

> >>>> ScriptLauncher.launchScript last arguments is a callback called when
> >>>> the script ended:

> >>>>         ScriptLauncher.launchScript(script, mInterpreterConfiguration,
> >>>>                 mProxy, new Runnable() {
> >>>>                     @Override
> >>>>                     public void run() {
> >>>>                         // here your script ended
> >>>>                     }
> >>>>                 });

> >>>> So do whatever you need in run(), add some print in the Java code to
> see
> >>>> better.

> >>>> On Wed, Sep 26, 2012 at 1:58 PM, Archana r
> >>>> <ramalingam.arch...@gmail.com> wrote:
> >>>> > Can u pls explain? I m not getting what you are saying

> >>>> > On Wed, Sep 26, 2012 at 2:53 PM, Anthony Prieur
> >>>> > <anthony.pri...@gmail.com>
> >>>> > wrote:

> >>>> >> Add some printf and check the exec path.

> >>>> >> On Wed, Sep 26, 2012 at 1:51 PM, Archana r
> >>>> >> <ramalingam.arch...@gmail.com>
> >>>> >> wrote:
> >>>> >> > Hi,
> >>>> >> > Actually I want to know, after ScriptLauncher.launchScript(),
> >>>> >> > where(from
> >>>> >> > which class) does the following get printed?

> >>>> >> > 09-26 09:41:11.881: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:11.891: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:11.891: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:11.891: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:11.901: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:11.901: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:11.911: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:12.071: D/dalvikvm(6427): mprotect(RO) failed (13),
> >>>> >> > file
> >>>> >> > will
> >>>> >> > remain read-write

> >>>> >> > 09-26 09:41:12.461: D/dalvikvm(6427): No JNI_OnLoad found in
> >>>> >> > /system/lib/libandroid_runtime.so 0x0, skipping init

> >>>> >> > 09-26 09:41:14.111:
> V/sl4a.SimpleServer$ConnectionThread:89(6411):
> >>>> >> > Server
> >>>> >> > thread 15 started.

> >>>> >> > 09-26 09:41:14.571: D/dalvikvm(6411): GC_CONCURRENT freed 509K,
> 55%
> >>>> >> > free
> >>>> >> > 2862K/6279K, external 410K/517K, paused 5ms+5ms

> >>>> >> > 09-26 09:41:15.011: D/dalvikvm(6411): GC_CONCURRENT freed 478K,
> 54%
> >>>> >> > free
> >>>> >> > 2893K/6279K, external 410K/517K, paused 5ms+6ms

> >>>> >> > 09-26 09:41:15.161: D/dalvikvm(6411): GC_FOR_MALLOC freed 189K,
> 54%
> >>>> >> > free
> >>>> >> > 2892K/6279K, external 410K/517K, paused 38ms

> >>>> >> > 09-26 09:41:15.161: I/dalvikvm-heap(6411): Grow heap (frag case)
> to
> >>>> >> > 5.777MB
> >>>> >> > for 8208-byte allocation

> >>>> >> > 09-26 09:41:15.251: D/dalvikvm(6411): GC_FOR_MALLOC freed 4K, 55%
> >>>> >> > free
> >>>> >> > 2895K/6343K, external 410K/517K, paused 75ms

> >>>> >> > 09-26 09:41:15.251: V/sl4a.JsonRpcServer:74(6411): Received:

> {"id":1,"method":"_authenticate","params":["c7b9507b-6249-4ea9-9776-87fd801 c9932"]}

> >>>> >> > 09-26 09:41:15.281: V/sl4a.JsonRpcServer:117(6411): Sent:
> >>>> >> > {"error":null,"id":1,"result":true}

> >>>> >> > 09-26 09:41:15.301: V/sl4a.JsonRpcServer:74(6411): Received:
> >>>> >> > {"id":2,"method":"makeToast","params":["hello javascript15"]}

> >>>> >> > 09-26 09:41:15.351: V/sl4a.JsonRpcServer:117(6411): Sent:
> >>>> >> > {"error":null,"id":2,"result":null}

> >>>> >> > 09-26 09:41:15.401: V/sl4a.JsonRpcServer:74(6411): Received:
> >>>> >> > {"id":3,"method":"notify","params":["javaScript","Success"]}

> >>>> >> > 09-26 09:41:15.451: V/sl4a.JsonRpcServer:117(6411): Sent:
> >>>> >> > {"error":null,"id":3,"result":null}

> >>>> >> > 09-26 09:41:15.561: D/dalvikvm(6427): GC_EXPLICIT freed 707K, 55%
> >>>> >> > free
> >>>> >> > 648K/1411K, external 0K/0K, paused 106ms

> >>>> >> > 09-26 09:41:15.611: D/dalvikvm(6427): GC_CONCURRENT freed 15K,
> 56%
> >>>> >> > free
> >>>> >> > 633K/1411K, external 0K/0K, paused 1ms+2ms

> >>>> >> > 09-26 09:41:15.811:
> V/sl4a.SimpleServer$ConnectionThread:100(6411):
> >>>> >> > Server
> >>>> >> > thread 15 died.

> >>>> >> > 09-26 09:41:15.822: V/sl4a.Process$1:135(6411): Process 6427
> exited
> >>>> >> > with
> >>>> >> > result code 0.

> >>>> >> > Thank you!!

> >>>> >> > On Wed, Sep 26, 2012 at 2:46 PM, Anthony Prieur
> >>>> >> > <anthony.pri...@gmail.com>
> >>>> >> > wrote:

> >>>> >> >> When your script ends:

> >>>> >> >> @Override
> >>>> >> >>  public void run() {

> >>>> >> >> Is executed, see line 195 of

> https://code.google.com/p/android-python27/source/browse/apk/src/com/...

> >>>> >> >> On Wed, Sep 26, 2012 at 12:36 PM, Archu
> >>>> >> >> <ramalingam.arch...@gmail.com>
> >>>> >> >> wrote:
> >>>> >> >> > Hi Anthony,

> >>>> >> >> > I am parsing a JSON(for my Python scripts) and able to see the
> >>>> >> >> > output
> >>>> >> >> > in
> >>>> >> >> > emulator. I want to modify the JSON fields and post it back to
> >>>> >> >> > the
> >>>> >> >> > server. I
> >>>> >> >> > used startActivityForResult() while calling the
> >>>> >> >> > ScriptActivity(so
> >>>> >> >> > that I
> >>>> >> >> > can
> >>>> >> >> > define HTTP Post method in onActivityResult()). But I want to
> >>>> >> >> > know
> >>>> >> >> > when
> >>>> >> >> > my
> >>>> >> >> > service(Script Service) gets over.?  I can define my HTTP Post
> >>>> >> >> > only
> >>>> >> >> > after
> >>>> >> >> > actual execution of my script Is there a means to do the same?

> >>>> >> >> > Regards,
> >>>> >> >> > Archana

> >>>> >> >> > On Tuesday, September 25, 2012 3:59:42 PM UTC+3, anthony
> wrote:

> >>>> >> >> >> Alternatively you can just put your scripts in a .zip, put
> the
> >>>> >> >> >> .zip
> >>>> >> >> >> in
> >>>> >> >> >> res/raw folder, fix variable name:

> https://code.google.com/p/android-python27/source/browse/apk/src/com/...

> >>>> >> >> >> "Run as -> Android Application", and you're done.

> >>>> >> >> >> On Tue, Sep 25, 2012 at 2:49 PM, Archu <
> ramalinga...@gmail.com>
> >>>> >> >> >> wrote:
> >>>> >> >> >> > Yes i am now able to execute my own scripts. Just I am
> >>>> >> >> >> > putting in
> >>>> >> >> >> > a
> >>>> >> >> >> > file
> >>>> >> >> >> > and
> >>>> >> >> >> > passing the File object to launchScript() method.

> >>>> >> >> >> > On Tuesday, September 25, 2012 4:56:59 AM UTC+3, Prat
> wrote:

> >>>> >> >> >> >> Hi Archu,

> >>>> >> >> >> >> I am working on a similar issue. Did you have any luck
> with
> >>>> >> >> >> >> python
> >>>> >> >> >> >> scripts
> >>>> >> >> >> >> in eclipse for android app?

> >>>> >> >> >> >> Regards,

> >>>> >> >> >> >> Prat

> >>>> >> >> >> >> On Wednesday, September 12, 2012 6:01:55 AM UTC-5, Archu
> >>>> >> >> >> >> wrote:

> >>>> >> >> >> >>> Hi, I m new to Android. I used the link

> http://jokar-johnk.blogspot.fi/2011/02/how-to-make-android-app-with-s...
> >>>> >> >> >> >>> to execute Python script in Android. However, I need to
> run
> >>>> >> >> >> >>> my
> >>>> >> >> >> >>> own
> >>>> >> >> >> >>> script(after parsing from a JSON file). In my case, I
> >>>> >> >> >> >>> cannot
> >>>> >> >> >> >>> place
> >>>> >> >> >> >>> the
> >>>> >> >> >> >>> script in /res/raw folder. Please let me know the
> >>>> >> >> >> >>> modifications
> >>>> >> >> >> >>> in
> >>>> >> >> >> >>> ScriptService.java. Any help will be appreciated. Thanks
> in
> >>>> >> >> >> >>> advance
> >>>> >> >> >> >>> !

> >>>> >> > --
> >>>> >> > Regards,
> >>>> >> > Archana

> >>>> > --
> >>>> > Regards,
> >>>> > Archana

> >>> --
> >>> Regards,
> >>> Archana

--
Regards,
Archana

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.