-
-
Notifications
You must be signed in to change notification settings - Fork 772
Closed
Labels
Description
I got the following Vim error when the completion after "re." kicked in:
Error detected while processing function pymode#rope#complete_on_dot..pymode#rope#complete:
line 5:
…/python-mode/pymode/libs2/rope/contrib/fixsyntax.py:24: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
Error detected while processing function pymode#rope#complete_on_dot..pymode#rope#complete:
line 5:
self.resource.read() == code:
Pattern not found
I think that this rope error should be a) more verbose in case of the mismatch, and b) more silent in the sense, that it may be a normal message ("echom"), and not an error, and not an error.
I have tried to find the source for this, via the following code, but that got not through to Vim:
import warnings
warnings.filterwarnings("error")
…
except UnicodeWarning, e:
raise exceptions.ModuleSyntaxError("-", "-", str(e)+"\n"+str(code)+"\n"+str(self.resource))
It is reproducible given a certain file, so if you want me to provide more information, let me know.
I have just upgrade pymode to latest master (892aa7d).
For reference, here's the latest patch of my attempt to debug it:
diff --git i/pymode/libs2/rope/contrib/fixsyntax.py w/pymode/libs2/rope/contrib/fixsyntax.py
index 870046c..65a6179 100644
--- i/pymode/libs2/rope/contrib/fixsyntax.py
+++ w/pymode/libs2/rope/contrib/fixsyntax.py
@@ -18,6 +18,8 @@ class FixSyntax(object):
msg = None
code = self.code
tries = 0
+ import warnings
+ warnings.filterwarnings("error")
while True:
try:
if tries == 0 and self.resource is not None and \
@@ -26,6 +28,8 @@ class FixSyntax(object):
force_errors=True)
return self.pycore.get_string_module(
code, resource=self.resource, force_errors=True)
+ except UnicodeWarning, e:
+ raise exceptions.ModuleSyntaxError("-", "-", str(e)+"\n"+str(code)+"\n"+str(self.resource))
except exceptions.ModuleSyntaxError, e:
if msg is None:
msg = '%s:%s %s' % (e.filename, e.lineno, e.message_)