ValvePython / vdf

📜 Package for working with Valve's text and binary KeyValue format
https://pypi.org/project/vdf/
MIT License
165 stars 30 forks source link

vdf2json: fix stdin/stdout for large inputs (TypeError: can't concat str to bytes) #43

Open markus-wa opened 2 years ago

markus-wa commented 2 years ago

not sure if this works for all python versions, but I had to do this to avoid a TypeError: can't concat str to bytes

$ cat csgo_english.txt.gz | gunzip | vdf2json > /dev/null
Traceback (most recent call last):
  File "/home/mark/.local/bin/vdf2json", line 8, in <module>
    sys.exit(main())
  File "/home/mark/.local/lib/python3.8/site-packages/vdf2json/cli.py", line 39, in main
    data = vdf.loads(args.infile.read(), mapper=OrderedDict)
  File "/usr/lib/python3.8/codecs.py", line 500, in read
    data = self.bytebuffer + newdata
TypeError: can't concat str to bytes

after the fix this works

$ cat csgo_english.txt.gz | gunzip | python3 vdf2json/vdf2json/cli.py > /dev/null
// all ok, no error
markus-wa commented 2 years ago

friendly ping to @rossengeorgiev :slightly_smiling_face: