Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

'base_path' argument error #63

Open
lamhai1401 opened this issue Jun 5, 2021 · 3 comments
Open

'base_path' argument error #63

lamhai1401 opened this issue Jun 5, 2021 · 3 comments

Comments

@lamhai1401
Copy link

lamhai1401 commented Jun 5, 2021

I'm using flask-swagger-0.2.14
but when i ran the first example like in your README.md

@app.route("/spec")
def spec():
   base_path = os.path.join(app.root_path, 'docs')
   return jsonify(swagger(app), from_file_keyword="swagger_from_file", base_path=base_path)

@app.route('/test', methods=['POST'])
def login():
   """
   swagger_from_file: test.yml
   """

I got this error

swagger() got an unexpected keyword argument 'base_path'

Could you tell me how to resolve it!
Thank in advance!

@OhMaley
Copy link

OhMaley commented Dec 21, 2022

I have the same issue.
No release since 2019/03/26 (date of release of the version you are using: 0.2.14). The base_path argument has been introduced in #48 from 2020/05/12, so you won't be able to use it until the next release.

One thing you can do is to use the master branch (which includes the changes you need). To use the master branch:
pip install git+https://github.com/getsling/flask-swagger@master

@aninhalacerda
Copy link

Same issue here.
Are you planning on releasing soon?

@Mattwmaster58
Copy link

Mattwmaster58 commented Mar 21, 2023

I think the solution mentioned above is the best we have for now. One thing I had to do was first uninstall flask-swagger, I suspect this is because master and PyPi specify they are the same version, whereas master actually has updated code. (Probably could've used --forced-reinstall, but be aware this reinstalls dependencies, and the dependency resolution will be done against what this package specifies, not what's in your requirements.txt or whatever, so TLDR, just uninstall and reinstall for the least problems ;))

I would caution against using the master branch, and instead pick a commit like the latest one as of the time of this comment, 23408f4

So your full pip install command:

pip uninstall -y flask-swagger && pip install git+https://github.com/getsling/flask-swagger@23408f4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants