mk-fg / pretty-yaml

PyYAML-based module to produce a bit more pretty and readable YAML-serialized data
Do What The F*ck You Want To Public License
135 stars 29 forks source link

TypeError: must be str, not bytes in Python 3 #11

Closed asmeurer closed 9 years ago

asmeurer commented 9 years ago
In [7]: pyaml.pprint("a")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-768996862cc6> in <module>()
----> 1 pyaml.pprint("a")

/Users/aaronmeurer/Documents/pretty-yaml/pyaml/__init__.py in pprint(*data, **dump_kws)
    169         dst = dump_kws.pop('file', dump_kws.pop('dst', sys.stdout))
    170         if len(data) == 1: data, = data
--> 171         dump(data, dst=dst, **dump_kws)
    172
    173 p, _p = pprint, print

/Users/aaronmeurer/Documents/pretty-yaml/pyaml/__init__.py in dump(data, dst, safe, force_embed, vspacing, string_val_style)
    161                 return buff.getvalue().decode('utf-8')
    162         else:
--> 163                 dst.write(buff.getvalue())
    164
    165 def dumps(data, **dump_kws):

TypeError: must be str, not bytes
mk-fg commented 9 years ago

As noted in the Installation section, Python-3.X is just not supported.

I think there were reports (in the closed issues/PRs) that the module works with 3.X after 2to3, but I'm not sure, never tried that myself I'm afraid, don't use 3.X here at all (yet?).

asmeurer commented 9 years ago

Are there at least plans to support it? These days I consider anything that doesn't support Python 3 to be a dead project.

mk-fg commented 9 years ago

While it's nowhere near the effort of porting and maintaining a separate version in a language you don't care much about (e.g. COBOL), I'm afraid I still don't have any plans to do it, sorry.