Jump to content


Derek Choi

Member Since 25 Jan 2015
Offline Last Active Jan 28 2015 07:22 PM
-----

Topics I've Started

Chpater8 (p312)

25 January 2015 - 11:38 PM

hi.
I do not speak English well.


AVD installed list
- SL4A_r6-1
- PythonForAndroid_r5
- Python3ForAndroid_r6



AVD Error ( Windows7 )
----------------------------------------------------------------------------------------
dlopen libpython2.6.so
http://192.168.56.1:...nerate_mames.py
Content-type: application/json
["james lee", "julie jones", "Mikey Mc", "Sarah Sweeney"]

Tracback (most recent call last):
files "/storage/sdcard/sl4a/scripts/mydroidtest.py", line 36, in <module>
athlete_names = json.loads( debug_msg )
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/
output/usr/lib/python2.6/json/__init__.py", line 307, in loads
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/
output/usr/lib/python2.6/json/decoder.py", line 319, in decode
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build
/output/usr/lib/python2.6/json/decoder.py", line 338, in decode
ValueError : No JSON object could be decoded

--------------------------------------------------------------------------------------------------



code (Linux mint - VirtualBox )
-----------------------------------------------------------------------------------------------------


def send_to_server(url, post_data=None):
if post_data:
page = urlopen(url, urlencode(post_data))
else:
page = urlopen(url)
return (page.read().decode("utf8"))

app = android.Android()

def status_update( msg, how_long=2 ):
app.makeToast( msg )
time.sleep( how_long )

status_update( hello_msg )

full_url = web_server + get_names_cgi
debug_msg = send_to_server( full_url )

print( full_url )
print( debug_msg )

athlete_names = json.loads( debug_msg ) # line 36
------------------------------------------------------------------------------------------------------