Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperlinks crash string bytes #248

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

NoSuck
Copy link

@NoSuck NoSuck commented Jan 19, 2023

Thank you for the useful utility.

This change prevents the following crash that occurs when invoked with the --hyperlinks option:

Traceback (most recent call last):
  File "./xlsx2csv.py", line 1214, in <module>
    main()
  File "./xlsx2csv.py", line 1207, in main
    xlsx2csv.convert(outfile, sheetid)
  File "./xlsx2csv.py", line 234, in convert
    self._convert(sheetid, outfile)
  File "./xlsx2csv.py", line 352, in _convert
    re.sub(r"(<v>[^<>]+)&#13;([^<>]+</v>)", r"\1\\r\2", sheet.filedata)))
  File "/usr/lib64/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object

This change prevents the following crash that occurs when invoked with the --hyperlinks option:

Traceback (most recent call last):
  File "./xlsx2csv.py", line 1214, in <module>
    main()
  File "./xlsx2csv.py", line 1207, in main
    xlsx2csv.convert(outfile, sheetid)
  File "./xlsx2csv.py", line 234, in convert
    self._convert(sheetid, outfile)
  File "./xlsx2csv.py", line 352, in _convert
    re.sub(r"(<v>[^<>]+)&dilshod#13;([^<>]+</v>)", r"\1\\r\2", sheet.filedata)))
  File "/usr/lib64/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object
@dilshod dilshod merged commit 78be285 into dilshod:master Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants