当我使用python-scapy时,bottle + uwsgi + nginx出错了

时间:2013-05-30 12:24:09

标签: python bottle

bootle调试说:

Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 764, in _handle
        return route.call(**args)
    File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1575, in wrapper
        rv = callback(*a, **ka)
    File "/home/tin/sg/main.py", line 30, in login
        user.login(sharer)
    File "/home/tin/sg/User.py", line 60, in login
        User.send_tcp(self.ip, sharer.id, sharer.password)
    File "/home/tin/sg/User.py", line 161, in send_tcp
        send(IP(src=ip, dst='destIP') / TCP(sport=sport, dport=80, seq=0, flags='S'))
    File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 251, in send
        __gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
    File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 307, in __init__
        self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
    File "/usr/lib/python2.7/socket.py", line 187, in __init__
        _sock = _realsocket(family, type, proto)

error: [Errno 1] Operation not permitted

当我在瓶内置函数run()中运行应用程序时,它可以正常工作。当我使用python-scapy中的send()时,报告此错误。 我对所有myapp文件都做了chown www-data:www-data

如何解决我的问题。

1 个答案:

答案 0 :(得分:0)

我自己找到了解决方案。 我修改了文件uwsgi.ini中的设置 添加执行权限

[uwsgi]
uid = root
gid = root
chmod-socket = 777