0

Initialising the following Flask webserver using api start app.py:

from flask import Flask
app = Flask(__name__)

Gives the error:

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'

It works fine when run directly, and Cherrypy works when run via MavProxy, so I assume it is pathing issue? The same error is listed here for Flask bootstrap, but bare Flask doesn't require a configuration path to be set.

Community
  • 1
  • 1
alexdavey
  • 672
  • 1
  • 9
  • 15

1 Answers1

1

DKPY2.0 (just released) doesn't have a MAVProxy dependency - scripts are run "stand alone". So as long as flask is in your Python environment this should "just work"

Hamish Willee
  • 372
  • 1
  • 3
  • 11