You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "[...]/pylatex/base_classes/latex_object.py", line 168, in generate_tex
with open(filepath + '.tex', 'w', encoding='utf-8') as newf:
~~~~~~~~~^~~~~~~~
TypeError: can't concat str to bytes
I suppose this says it all..
The text was updated successfully, but these errors were encountered:
This isn't a pylatex issue, you're trying to concatanate filepath, which presumably isn't a string, to '.tex', which is a string. You need to first cast filepath to a str
I disagree. not all bytestrings can be casted to str. some filesystems (ie. xfs, zfs) accept bytes that cannot be encoded in human-readable strings (ie. ascii, utf)
the code should read sth like
try:
with open(filepath + '.tex', 'w', encoding='utf-8') as newf:
...
except TypeError:
with open(filepath + b'.tex', 'w', encoding='utf-8') as newf:
...
I suppose this says it all..
The text was updated successfully, but these errors were encountered: