alek-sys / sublimetext_indentxml

Plugin for Sublime Text editor for reindenting XML and JSON files
MIT License
534 stars 135 forks source link

SublimeText3 TypeError: can't concat bytes to str #32

Closed justgook closed 11 years ago

justgook commented 11 years ago

Traceback (most recent call last): File "/opt/sublime_text/sublimeplugin.py", line 531, in run return self.run(edit) File "~/.config/sublime-text-3/Installed Packages/Indent XML.sublime-package/indentxml.py", line 44, in run File "~/.config/sublime-text-3/Installed Packages/Indent XML.sublime-package/indentxml.py", line 77, in indent File "~/.config/sublime-text-3/Installed Packages/Indent XML.sublime-package/indentxml.py", line 100, in indent TypeError: can't concat bytes to str

TheChrisPratt commented 11 years ago

I'm seeing this in Sublime Text 3 as well. The plugin works awesome under Sublime Text 2, but blows up in ST3.

Traceback (most recent call last):
  File "E:\Development\Sublime Text 3\sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "C:\Users\Chris\AppData\Roaming\Sublime Text 3\Packages\sublimetext_indentxml\indentxml.py", line 49, in run
    s = self.indent(s)
  File "C:\Users\Chris\AppData\Roaming\Sublime Text 3\Packages\sublimetext_indentxml\indentxml.py", line 100, in indent
    s = xmlheader.group() + "\n" + s
TypeError: can't concat bytes to str

But, I found that changing line 100 to:

                s = xmlheader.group().decode("utf-8") + "\n" + s

fixes the problem. (Chris)

jamesstout commented 11 years ago

@TheChrisPratt - thanks this fixed it for me.

dickinsonjl commented 11 years ago

@TheChrisPratt fixed the issue for me too :+1:

ghost commented 11 years ago

Oh, I didn't see that there was already a commit linked to this issue. Why isn't it merged already?

alek-sys commented 11 years ago

Because I'm busy as a bee :) Sorry, merged now - seems to be working fine in both ST2 / ST3