Jump to content


Photo

Chpater8 (p312)


  • Please log in to reply
2 replies to this topic

#1 Derek Choi

Derek Choi

    New Member

  • Members
  • Pip
  • 3 posts

Posted 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
------------------------------------------------------------------------------------------------------

Edited by Derek Choi, 25 January 2015 - 11:59 PM.


#2 Derek Choi

Derek Choi

    New Member

  • Members
  • Pip
  • 3 posts

Posted 27 January 2015 - 11:39 PM

hi.
I do not speak English well.

Tried the test again.
1. Create a new AVD.
2. 'SL4A_r6-1' installation
3. 'pythonfor android_r5' installation
4. 'mydroidtest.py' copied to the AVD
5. Run
 
The results were the same.

install "Python3ForAndroid_r6" and run "mydroidtest.py"
output. "..python3m link error..."

#3 Derek Choi

Derek Choi

    New Member

  • Members
  • Pip
  • 3 posts

Posted 28 January 2015 - 02:05 AM

Hi
I found a bug.
I'm an idiot.

athletemodel.py
------------------------------------------
def get_names_from_store():
athletes = get_from_store()
response = [athletes[each_ath].name for each_ath in athletes]

print(response) # Did not know whether this is a problem.

return (response)
------------------------------------------

I was wasting time of three days because of this bug.
I am so sad.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users