Open rohdef opened 13 years ago
i have this problem, too. when I use emacs. M-x pysmell-make-tags RET this step is OK. then M-/ can't work, appear this problem.
debian lenny, python 2.5, Pymacs 0.24 beta1, pysmell 0.7.3
if the .py file has multi-byte character , pysmell doesn't work!
just like this :
pymacs-report-error: Python: Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/Pymacs/pymacs.py", line 147, in loop
value = eval(text)
File "
change codefinder.py ,lines 487 to : tree = compiler.parse(replacedSource.encode('ascii', 'ignore'))
Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/idehelper.py", line 262, in detectCompletionType klass, parents = inferInstance(fullPath, AST, lineNo, var, PYSMELLDICT) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/idehelper.py", line 105, in inferInstance names, klasses = getNames(AST) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 527, in getNames compiler.walk(tree, inferer, walker=ExampleASTVisitor(), verbose=1) File "/usr/lib/python2.5/compiler/visitor.py", line 106, in walk walker.preorder(tree, visitor) File "/usr/lib/python2.5/compiler/visitor.py", line 63, in preorder self.dispatch(tree, args) # XXX args make sense? File "/usr/lib/python2.5/compiler/visitor.py", line 84, in dispatch meth(node, *args) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 505, in handleChildren BaseVisitor.handleChildren(self, node)
......
File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 129, in handleChildren self.visit(c) File "/usr/lib/python2.5/compiler/visitor.py", line 84, in dispatch meth(node, _args) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 102, in decorated self.handleChildren(args[0]) meth(node, args) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 101, in decorated fun(self, args, *_kwargs) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 516, in visitAssign self.names[name] = getName(node.expr) File "/usr/lib/python2.5/site-packages/pysmell-0.7.1-py2.5.egg/pysmell/codefinder.py", line 316, in getName return repr(str(node.value)) UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-3: ordinal not in range(128)
What steps will reproduce the problem?
What is the expected output? What do you see instead? Expected: method's list Instead we got a nice traceback, something like attached.
What version of the product are you using? On what operating system? PySmell 0.7.1 on Gentoo Python 2.5
Please provide any additional information below. Solution to this problem was replacing str() with unicode() in codefinder.py at lines: 301, 314, 316 (I don't know why, but I had to change[remove '.value'] also lines 337 and 340 in codefinder.py, because of "object has no attribute 'value'". Is this another issue?)