parserator icon indicating copy to clipboard operation
parserator copied to clipboard

TypeError: 'write() argument 1 must be unicode, not str'

Open joeribelis opened this issue 5 years ago • 1 comments

python 2.7

:~/parser$ parserator init test_123

Initializing directories for test_123 <open file '', mode 'w' at 0x7f98203211e0>

  • test_123 <open file '', mode 'w' at 0x7f98203211e0>
  • raw <open file '', mode 'w' at 0x7f98203211e0>
  • training <open file '', mode 'w' at 0x7f98203211e0>
  • tests <open file '', mode 'w' at 0x7f98203211e0>

Generating init.py <open file '', mode 'w' at 0x7f98203211e0> Traceback (most recent call last): File "/home/joerib/.local/bin/parserator", line 8, in sys.exit(dispatch()) File "/home/joerib/.local/lib/python2.7/site-packages/parserator/main.py", line 70, in dispatch args.func(args) File "/home/joerib/.local/lib/python2.7/site-packages/parserator/main.py", line 118, in init f.write(parser_template.init_template()) TypeError: write() argument 1 must be unicode, not str

joeribelis avatar Dec 30 '20 10:12 joeribelis

replacing "w" with "wb" https://stackoverflow.com/questions/45520097/wb-vs-w-in-unix-for-python

seems to fix it

joeribelis avatar Dec 30 '20 10:12 joeribelis