Mercurial > kallithea
view MANIFEST.in @ 8457:c91f5f36fb2b stable
api: fix 'kallithea-api --save-config'
Commit eca0cb56a822 attempted to fix a type inconsistency, which caused
failure in the 'kallithea-api' tool when using '--save-config', but this
unfortunately did not fix the problem completely.
Following error still appeared:
Traceback (most recent call last):
File ".../bin/kallithea-api", line 33, in <module>
sys.exit(load_entry_point('Kallithea', 'console_scripts', 'kallithea-api')())
File ".../bin/kallithea_api.py", line 84, in main
'apihost': args.apihost})
File ".../bin/base.py", line 104, in __init__
self.make_config(config)
File ".../bin/base.py", line 132, in make_config
ext_json.dump(config, f, indent=4)
File "/usr/lib/python3.7/json/__init__.py", line 180, in dump
fp.write(chunk)
TypeError: a bytes-like object is required, not 'str'
The json module documentation says:
https://docs.python.org/3.7/library/json.html#basic-usage
"The json module always produces str objects, not bytes objects. Therefore,
fp.write() must support str input."
Therefore, instead of opening the file in binary mode and writing bytes,
open it in text mode and write strings.
For symmetry reasons, we make the same change when _loading_ the config
file, but this code worked regardless.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Thu, 10 Sep 2020 20:17:18 +0200 |
parents | 97c5e6ac5c75 |
children | 495dea7c2a13 |
line wrap: on
line source
include .coveragerc include .eslintrc.js include Apache-License-2.0.txt include CONTRIBUTORS include COPYING include Jenkinsfile include LICENSE-MERGELY.html include LICENSE.md include MIT-Permissive-License.txt include README.rst include conftest.py include dev_requirements.txt include development.ini include pytest.ini include requirements.txt include tox.ini recursive-include docs * recursive-include init.d * recursive-include kallithea/alembic * include kallithea/bin/ldap_sync.conf include kallithea/lib/paster_commands/template.ini.mako recursive-include kallithea/front-end * recursive-include kallithea/i18n * recursive-include kallithea/public * recursive-include kallithea/templates * recursive-include kallithea/tests/fixtures * recursive-include kallithea/tests/scripts * include kallithea/tests/models/test_dump_html_mails.ref.html include kallithea/tests/performance/test_vcs.py include kallithea/tests/vcs/aconfig recursive-include scripts *