AttributEerror:'module'对象没有属性'application'

时间:2014-01-28 04:53:14

标签: python raspberry-pi communication web.py raspbian

我按照这个练习http://webpy.org/docs/0.3/tutorial查看它是如何工作的,但是发生了错误,我无法解决它。

我在我的树莓上做了这个,将像hello world这样的数据/行发送到电脑

sudo apt-get install python-webpy

mkdir webpy
cd webpy
nano server.py

我输入以下内容:

#!/usr/bin/python
import web

urls = (
    '/', 'index'
)

class index:
    def GET(self):
        return "Hello, world!"

if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()`enter code here`
Then I control+x to save under the name server.py

我首先尝试python server.py

然后chmod +x server.py thn ./server.py

但两者都是

traceback (most recent call last):
 File server.py, line 11 ,in <module>
app - web.application(urls, globals())
AttributeError:'module' object has no attribute 'application'.

我不知道是否我的web.py没有下载最新的一个使用以下命令,因为我的是使用raspbian。

0 个答案:

没有答案