玩蛇网提供最新Python编程技术信息以及Python资源下载!

bottlepy用mod_wsgi权限错误如何解决

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

为什么这里会发生权限错误呢?但是我用bottle内置的run()的时候是没有任何问题的。我的wsgi文件是这么设置的

import os, sys, bottle

sys.path = ['/home/tin/sg'] + sys.path
os.chdir(os.path.dirname(__file__))

import main

bottle.debug(True)
application = bottle.default_app()

结构:

.
├── main.py
├── User.py
└── views
    ├── template files

自己解决了,问题在于执行权限

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

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/wenda/wd20191.html

相关文章 Recommend

玩蛇网Python互助QQ群,欢迎加入-->: 106381465 玩蛇网Python新手群
修订日期:2017年05月19日 - 13时16分40秒 发布自玩蛇网

您现在的位置: 玩蛇网首页 > Python问题解答 > 正文内容
我要分享到:

必知PYTHON教程 Must Know PYTHON Tutorials

必知PYTHON模块 Must Know PYTHON Modules