Error generating Swagger server (Python Flask) from Swagger Editor

Source: Internet
Author: User

1down Votefavorite  

Http://stackoverflow.com/questions/36416679/error-generating-swagger-server-python-flask-from-swagger-editor

I ' ve used the Swagger Editor to manually generate my Swagger spec file and generated the files for a Python Flask server. Following the README I installed connexion, but if I run python app.py I get the error:ValueError:need more than 1 value to u Npack. Any ideas?

Full stack trace below:

NoHandlers could be foundForLogger"Connexion.api"Traceback (Most recent): File "App.py",Line5, Inch <Module>App.Add_api(' Swagger.yaml ') File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/app.py",Line144, InchAdd_api Debug=Self.Debug) File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/api.py",Line127, Inch__init__ Self.Add_paths() File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/api.py",Line198, InchAdd_paths Six.Reraise(*Sys.Exc_info()) File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/api.py",Line187, InchAdd_paths Self.Add_operation(Method,Path,Endpoint,Path_parameters) File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/api.py",Line160, InchAdd_operation Resolver=Self.Resolver) File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/operation.py",Line168, Inch__INIT__ resolution=Resolver.Resolve(Self) File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/resolver.py",Line50, InchResolveReturn Resolution(Self.resolve_function_from_operation_id(operation_id),operation_id) File "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/resolver.py",Line71, Inchresolve_function_from_operation_idReturnSelf.Function_resolver(operation_id  file /library/ frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/connexion/utils.py ",< Span class= "PLN" > line 106, in  Get_function_from_name module_name, attr_path1 = Module_name., 1)  Valueerror: need more than 1 value to unpack< /span>                
python flask swagger    
share|improve This question          asked APR 5 at 3:36            tw1742         117211        
1
please open a ticket via github.com/ Swagger-api/swagger-codegen/issues for tracking.                     – wing328                  APR 6 at 4:45                                                                                 
Add a Comment |
1 Answer 1 Active oldest votes
          up Vote3down voteaccepted span>

I ran into the as well. From what I see, the generated code from Swagger seems to assume you ' re using Python 3. While Connexion supports both Python 2.7 & 3.4+, it does need a __init__.py file in the generated python-flask-server/ base directory as we ll as inside the subdirectory to work for controllers/ Python 2.7 (implicit Namespace Packages were introduced in Python 3.3). If you create those 2 empty files through generating the code, things should work. If The Swagger generator wants to support Python 2.7 (since Connexion allows for it), it would just need to provide those Files as well.

Error generating Swagger server (Python Flask) from Swagger Editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.