nginxinc / crossplane

Quick and reliable way to convert NGINX configurations into JSON and back.
Apache License 2.0
717 stars 86 forks source link

Format and minify don't work with python 3 #9

Closed aluttik closed 7 years ago

aluttik commented 7 years ago

str instances don't have .encode or .decode methods in python 3.

Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 217, in <module>
    main()
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 213, in main
    func(**kwargs)
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 138, in format
    out.write('\n'.join(lines) + '\n')
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 129, in _format
    for line in _format(obj['block'], depth=depth+1):
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 116, in _format
    args = [_enquote(arg) for arg in obj['args']]
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 116, in <listcomp>
    args = [_enquote(arg) for arg in obj['args']]
  File "/Users/aluttik/code/crossplane/crossplane/__main__.py", line 70, in _enquote
    return repr(arg.decode('string_escape'))
AttributeError: 'str' object has no attribute 'decode'