qpython控制台无法运行helloworld.py

问题描述:

我最近安装我的Android手机,这是在运行Android上QPython版本1.2.1 4.2.2果冻豆。我可以使用QPython上的控制台执行一些python命令,但遇到运行helloworld.py脚本时出现问题,这是第一次安装QPython时附带的脚本。qpython控制台无法运行helloworld.py

helloworld.py:

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

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

控制台上运行的文件helloworld.py后的输出是这样的:

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模块方法也不管用,如果从控制台称为。

+0

是什么'helloworld.py'文件包含哪些内容? –

+0

编辑了这篇文章并添加了脚本helloworld.py –

+0

您是否尝试了以下基本知识:按此顺序重新启动手机,强制停止应用程序,清除缓存和本地应用程序数据,卸载并重新安装? – Lombas

也许修改了/ etc/hosts。恢复它作为一部开拓创新,如下图所示:

127.0.0.1本地主机

并再次尝试qpython。

你用旧的qpython,请给一个尝试最新的一个https://github.com/qpython-android/qpython/releases