0

I recently installed QPython version-1.2.1 on my Android phone, which is running on Android 4.2.2 Jelly-Bean. I can use the console on QPython to execute some python commands, but having problem running the helloworld.py script that comes with QPython the first time it is installed.

helloworld.py:

#-*-coding:utf8;-*-
#qpy:console
#qpy:2

import androidhelper
droid = androidhelper.Android()
line = droid.dialogGetInput()
s = "Hello, %s" % (line.result,)
droid.makeToast(s)

The output of console after running the file helloworld.py is this:

Traceback (most recent call last):
  File "/storage/sdcard0/com.hipipal.qpyplus/scripts/helloworld.py", line 12, in <module>
     droid = androidhelper.Android()
  File "/storage/sdcard0/com.hipipal.qpyplus/lib/python2.7/site-packages/androidhelper/sl4a.py", line 34, in __init__
     self.conn = socket.create_connection(addr)
  File "/QPython/QPython2-core/build/python-install/lib/python2.7/socket.py", line 553, in create_connection
     socket.gaierror: [Errno 7] no address associated with hostname.

androidhelper module methods does not work either, if called from console.

Asiful Nobel
  • 323
  • 4
  • 14
  • What does this `helloworld.py` file contain? – George Daramouskas Sep 27 '15 at 17:02
  • edited the post and added the script helloworld.py – Asiful Nobel Sep 27 '15 at 17:31
  • Have you tried the basics: restarting the phone, force stopping the app, clearing the cache and local app data, uninstalling and re installing, in this order? – Lombas Oct 30 '15 at 10:54
  • Have you tried the Qpython3 app instead? – Lombas Oct 30 '15 at 10:55
  • Yes, I had installed the QPython3 app and same result. I had also restarted the phone, cleared the cache, uninstalled both apps and re-installed....Un-rooted the phone using super user(to see if it works), then factory reset the phone and reinstalled QPython. But no luck, I could not make those modules work. – Asiful Nobel Oct 30 '15 at 18:12

2 Answers2

0

Maybe /etc/hosts is modified. Restore it as orignal, like below:

127.0.0.1 localhost

and try qpython again.

0

You were using the old qpython, please give a try the newest one https://github.com/qpython-android/qpython/releases

River
  • 206
  • 1
  • 4