swagger-api / swagger-api/swagger-codegen
python-flask `ValueError: source code string cannot contain null bytes`
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm getting error when trying to run python -m swagger_server
(venv) bu@debian:~/repos/api/out$ python -m swagger_server
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/local/lib/python3.10/runpy.py", line 146, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/local/lib/python3.10/runpy.py", line 110, in _get_module_details
__import__(pkg_name)
ValueError: source code string cannot contain null bytes
when using online generator Im not getting this issue
Swagger-codegen version
2.4.32
Swagger declaration file content or url
https://raw.githubusercontent.com/gotify/server/v2.3.0/docs/spec.json
Command line used for generation
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate -i /local/gotify-swagger.yaml -l python-flask -o /local/out
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the python-flask generator command and the generated out/swagger_server package, using the linked Gotify spec.json as input. Inspect the generated Python files for the reported null-byte failure, then run python -m swagger_server to reproduce it. Done means the same generation and module-start workflow no longer raises this error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100