Hello,
I am recently facing this error when using swagger-ui.
Traceback (most recent call last):
File "app/project.py", line 14, in <module>
api_doc(app, config_path='swagger.yml', url_prefix='', title='Topic Model API')
File "/usr/local/lib/python3.7/site-packages/swagger_ui/core.py", line 36, in __init__
self._auto_match_handler()
File "/usr/local/lib/python3.7/site-packages/swagger_ui/core.py", line 273, in _auto_match_handler
return self._flask_handler()
File "/usr/local/lib/python3.7/site-packages/swagger_ui/core.py", line 122, in _flask_handler
static_folder=self.static_dir, static_url_path='/'
File "/usr/local/lib/python3.7/site-packages/flask/blueprints.py", line 187, in __init__
self.static_folder = static_folder
File "/usr/local/lib/python3.7/site-packages/flask/helpers.py", line 1004, in static_folder
value = value.rstrip("/\\")
AttributeError: 'PosixPath' object has no attribute 'rstrip'
I use swagger_ui in this way:
from swagger_ui import api_doc
app = Flask(__name__)
CORS(app)
api_doc(app, config_path='swagger.yml', url_prefix='', title='Topic Model API')
Trying to understand the problem, I am seeing that self.static_dir is indeed a PosixPath.
The problem is solved inserting in core.py@line120 the cast to str:
Hello,
I am recently facing this error when using swagger-ui.
I use swagger_ui in this way:
Trying to understand the problem, I am seeing that
self.static_dir
is indeed a PosixPath. The problem is solved inserting in core.py@line120 the cast tostr
: