Giter Club home page Giter Club logo

Comments (3)

fcying avatar fcying commented on July 3, 2024

after modify def raise_ex() to class raise_ex(), it can raise the right log, it's abnormal by use let g:ncm2#matcher = 'substrfuzzy', if I use default matcher, it work fine.

diff --git a/pythonx/ncm2_pyclang_proc.py b/pythonx/ncm2_pyclang_proc.py
index d25eaee..fce4ad6 100644
--- a/pythonx/ncm2_pyclang_proc.py
+++ b/pythonx/ncm2_pyclang_proc.py
@@ -69,7 +69,7 @@ class Source(Ncm2Source):
             except Exception as ex:
                 from neovim import Nvim
                 nvim = self.nvim  # type: Nvim
-                def raise_ex():
+                class raise_ex():
                     raise ex
                 nvim.async_call(raise_ex)
             finally:
[ncm2_pyclang_proc@yarp] Exception in thread Thread-1:
[ncm2_pyclang_proc@yarp] Traceback (most recent call last):
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.pyenv/versions/3.6-dev/lib/python3.6/threading.py", line 916, in _bootstrap_inner
[ncm2_pyclang_proc@yarp]     self.run()
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.pyenv/versions/3.6-dev/lib/python3.6/threading.py", line 864, in run
[ncm2_pyclang_proc@yarp]     self._target(*self._args, **self._kwargs)
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2-pyclang/pythonx/ncm2_pyclang_proc.py", line 72, in worker_loop
[ncm2_pyclang_proc@yarp]     class raise_ex():
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2-pyclang/pythonx/ncm2_pyclang_proc.py", line 73, in raise_ex
[ncm2_pyclang_proc@yarp]     raise ex
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2-pyclang/pythonx/ncm2_pyclang_proc.py", line 65, in worker_loop
[ncm2_pyclang_proc@yarp]     task()
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2-pyclang/pythonx/ncm2_pyclang_proc.py", line 333, in <lambda>
[ncm2_pyclang_proc@yarp]     lambda: self.on_complete_task(context, data, lines)])
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2-pyclang/pythonx/ncm2_pyclang_proc.py", line 395, in on_complete_task
[ncm2_pyclang_proc@yarp]     if not matcher(base, item):
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2/pythonx/ncm2_matcher/substrfuzzy.py", line 100, in match
[ncm2_pyclang_proc@yarp]     hl = fuzzy_match(b, m[key], chcmp)
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2/pythonx/ncm2_matcher/substrfuzzy.py", line 18, in fuzzy_match
[ncm2_pyclang_proc@yarp]     return substr_fuzzy_match(b, s, abbrs, chcmp)
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2/pythonx/ncm2_matcher/substrfuzzy.py", line 54, in substr_fuzzy_match
[ncm2_pyclang_proc@yarp]     start = abbrs[0]
[ncm2_pyclang_proc@yarp] IndexError: list index out of range

from ncm2-pyclang.

roxma avatar roxma commented on July 3, 2024
[ncm2_pyclang_proc@yarp] Traceback (most recent call last):
[ncm2_pyclang_proc@yarp]   File "/home/fcying/.vim/plugged/ncm2-pyclang/pythonx/ncm2_pyclang_proc.py", line 73, in raise_ex
[ncm2_pyclang_proc@yarp]     raise ex
[ncm2_pyclang_proc@yarp] TypeError: exceptions must derive from BaseException

after modify def raise_ex() to class raise_ex(), it can raise the right log

Why ?

from ncm2-pyclang.

fcying avatar fcying commented on July 3, 2024

https://www.cnblogs.com/bidepanpan/p/7115153.html

TypeError: exceptions must derive from BaseException

异常必须从基础异常类中派生。然后看了下自己的第一行。用的是def,这是创建了一个方法。。而不是一个类,简单的语法错误。只要将第一行的def改成class

from ncm2-pyclang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.