0

使用以下 Flask 网络服务器初始化api start app.py

from flask import Flask
app = Flask(__name__)

给出错误:

Exception in APIThread-0: 'NoneType' object has no attribute 'startswith'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 333, in run
    self.fn()
  File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 625, in <lambda>
    APIThread(self, lambda: execfile(args[1], g), args[1])
  File "simple.py", line 2, in <module>
    app = Flask(__name__)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 319, in __init__
    template_folder=template_folder)
  File "/usr/local/lib/python2.7/dist-packages/flask/helpers.py", line 741, in __init__
    self.root_path = get_root_path(self.import_name)
  File "/usr/local/lib/python2.7/dist-packages/flask/helpers.py", line 649, in get_root_path
    return os.path.dirname(os.path.abspath(filepath))
  File "/usr/lib/python2.7/posixpath.py", line 352, in abspath
    if not isabs(path):
  File "/usr/lib/python2.7/posixpath.py", line 61, in isabs
    return s.startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'

直接运行时工作正常,而 Cherrypy 通过 MavProxy 运行时工作正常,所以我认为这是路径问题?此处为Flask bootstrap列出了相同的错误,但裸 Flask 不需要设置配置路径。

4

1 回答 1

1

DKPY2.0(刚刚发布)没有 MAVProxy 依赖项 - 脚本“独立”运行。因此,只要烧瓶在您的 Python 环境中,它就应该“正常工作”

于 2015-10-28T02:49:56.667 回答