开发者

Passing parameters to a python script using SL4A on Android

I am trying to get a Python script which I normally run on my PC to run o开发者_运维问答n my Android phone (HTC Hero). I have SL4A running on my phone and have made a few tweaks to the Python script so that this does now run. The problem that I am having is how to pass parameters to the script. I have tried creating a sh script in SL4A which called the python file with the parameters, but this didn't work. I have also tried using the app TaskBomb to call through to the python file, but again this doesn't work when parameters are supplied. When no params are supplied the file loads correctly, but when I add -h to the filename it says it can no longer find the python file I am calling.

Is anybody able to provide assistance with how to this?


I would suggest modifying the script to call getDialogInput.

import android
app = android.Android()
response = app.dialogGetInput(Title, Message, Default_Values).result

Then set whatever variable the script expects the parameters to be in to response.

Ive done this and also modified a script to get the android clipboard instead of taking input directly. You could always make several versions of the script with hard coded parameters.

Hope this helps as im pretty new to python and sl4a.


I used a round about method to circumvent the problem. First the python script needs to be modified to look for a text file containing the attributes. Now whenever I need to start the script, i have to push the txt file containing the attributes and then start the script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜