anaconda-mode在emacs-daemon下Error

anaconda-mode buffer的内容如下,正常开emacs的话没问题,但是用daemon开的emacsclient就出错了,没法补全了

anaconda_mode port 45731 127.0.0.1 - - [24/Sep/2018 15:28:51] ================================================================================ Traceback (most recent call last): File “/home/user/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py”, line 101, in apply result = method(**params) File “”, line 79, in wrapper File “”, line 109, in company_complete File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/api/init.py”, line 174, in completions completions = completion.completions() File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/api/completion.py”, line 97, in completions completion_names = self._get_context_completions() File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/api/completion.py”, line 196, in _get_context_completions completion_names += self._trailer_completions(dot.get_previous_leaf()) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/api/completion.py”, line 231, in _trailer_completions contexts = evaluate_call_of_leaf(evaluation_context, previous_leaf) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/helpers.py”, line 99, in evaluate_call_of_leaf values = context.eval_node(base) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/base_context.py”, line 139, in eval_node return self.evaluator.eval_element(self, node) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/init.py”, line 194, in eval_element return self._eval_element_if_evaluated(context, element) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/init.py”, line 206, in _eval_element_if_evaluated return self._eval_element_cached(context, element) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/cache.py”, line 40, in wrapper rv = function(obj, *args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/init.py”, line 210, in eval_element_cached return eval_node(context, element) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/debug.py”, line 79, in wrapper return func(*args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/syntax_tree.py”, line 48, in wrapper return func(context, *args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/syntax_tree.py”, line 72, in eval_node return eval_atom(context, element) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/syntax_tree.py”, line 208, in eval_atom search_global=True File "/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/compatibility.py", line 264, in return lambda *args, **kwargs: self.func(obj, *args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/base_context.py”, line 156, in py__getattribute return f.find(filters, attribute_lookup=not search_global) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/debug.py”, line 79, in wrapper return func(*args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/finder.py”, line 56, in find names = self.filter_name(filters) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/finder.py”, line 141, in filter_name for filter in filters: File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/filters.py”, line 505, in get_global_filters origin_scope=origin_scope): File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/context/module.py”, line 63, in get_filters for star_module in self.star_imports(): File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/cache.py”, line 40, in wrapper rv = function(obj, *args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/context/module.py”, line 75, in star_imports new = infer_import(self, name) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/cache.py”, line 40, in wrapper rv = function(obj, *args, **kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/imports.py”, line 78, in infer_import types = importer.follow() File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/imports.py”, line 279, in follow return self._do_import(self.import_path, self.sys_path_with_modifications()) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/imports.py”, line 357, in _do_import sys_path=sys_path, File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/compiled/subprocess/init.py”, line 93, in wrapper kwargs=kwargs, File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/compiled/subprocess/init.py”, line 158, in run return self._send(id(evaluator), function, args, kwargs) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/evaluate/compiled/subprocess/init.py”, line 202, in _send is_exception, traceback, result = pickle_load(self._process.stdout) File “/home/user/Alpha/anaconda3/lib/python3.6/site-packages/jedi/_compatibility.py”, line 471, in pickle_load return pickle.load(file, encoding=‘bytes’) TypeError: argument 1 must be str, not bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/home/user/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/providers/basehttp.py”, line 40, in do_POST status, response = self.server.service(data) File “/home/user/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py”, line 50, in call result = self.apply(method, args) File “/home/user/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py”, line 105, in apply server_error(args[‘id’], error) File “/home/user/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/errors.py”, line 91, in server_error raise ServiceException(500, dumps(response)) service_factory.exceptions.ServiceException: (500, ‘{“jsonrpc”: “2.0”, “id”: 1, “error”: {“code”: -32000, “message”: “Server error”, “data”: “TypeError(‘argument 1 must be str, not bytes’,)”}}’)

借这个帖子吐槽一下论坛贴图的放大,如果像楼主这样两个图片并列,点击图片不是放大而是下一张图。除了下载没有其它办法放大了吗? @xuchunyang

是启动过程中出错,还是使用过程中出错?最好把详细步骤写出来。


另外,daemon 可能会改变你初始化代码的顺序。因为 daemon 启动的时候,它处于一个很诡异的状态:不是终端,也不是GUI。直到你 client 打开了 GUI,才能确定是 GUI。

而在 client 运行之前,初始化工作绝大部分都已经完成。如果你有用到 window-system / display-graphic-p / noninteractive 作为分支判断条件,很可能代码跑偏了。

To @et2010

印象中一个图片点开之后(出现 Lightbox 效果),再点击并没有放到的功能。 (试了下其实有)

放一张图片试试:

一个 Work-Around 是用新标签或窗口打开这个图片,然后放大。

1 个赞

应该是使用过程出错吧,启动的时候都还没anaconda-mode的buffer呢,在编辑python文件试图补全时出错,底下也就显示Sever error: TypeError(‘argument 1 must be str, not bytes’,),打开anaconda-mode的buffer就有那些内容了。只在emacsclient会这样。没了