Hello,
I haven’t worked with python or c++ before and i’ve run into an error I can’t figure out in an html entities conversion plugin i’m trying to write.
here’s the error:
Traceback (most recent call last):
File "./sublime_plugin.py", line 255, in run_
File "./unicodeToEntities.py", line 19, in run
self.view.replace(region, txt)
Boost.Python.ArgumentError: Python argument types in
View.replace(View, Region, unicode)
did not match C++ signature:
replace(SP<TextBufferView>, SP<Edit>, SelectionRegion, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >)
and here’s my code:
[code]import sublime, sublime_plugin
from htmlentitydefs import codepoint2name
class UnicodeToEntitiesCommand(sublime_plugin.TextCommand):
def run(self, edit):
htmlentities = list()
for region in self.view.sel():
if not region.empty():
s = self.view.substr(region)
for c in s:
if ord© < 128:
htmlentities.append©
else:
htmlentities.append(’&%s;’ % codepoint2name[ord©])
txt = ''.join(htmlentities)
print txt, "txt"
self.view.replace(region, txt)
[/code]
Could any kind person help me out with this?
Thanks.