简体   繁体   English

获取未知编码:idna,然后无法在Eclipse的python PyDev插件中进行调试

[英]Getting Unknown encoding: idna and then unable to debug in python PyDev plugin on eclipse

Colleague provided me set of py files for testing, which are running fine on his machine. 同事为我提供了一组py文件进行测试,这些文件在他的计算机上运行良好。 However when I run the py files, I am getting following error: 但是,当我运行py文件时,出现以下错误:

Traceback (most recent call last):
  File "D:\workspaces\pyworkspace\Analytics Python\python_server\server1.py", line 84, in <module>
    start_server()
  File "D:\workspaces\pyworkspace\Analytics Python\python_server\server1.py", line 57, in start_server
    socketObj.bind(server_address)
LookupError: unknown encoding: idna

Here , it says to add import encodings.idna . 在这里 ,它说要添加import encodings.idna So I added that import (even though eclipse says "unused import"), but still getting the same error. 因此,我添加了该导入(即使eclipse表示“未使用的导入”),但仍然出现相同的错误。 So I put some breakpoints and started up debugging, but debugger didnt hit the breakpoints. 所以我放了一些断点并开始调试,但是调试器并没有达到断点。 The program termniates without hitting any breakpoints giving following error: 程序终止,而没有遇到任何断点,给出以下错误:

pydev debugger: starting (pid: 8316)
Traceback (most recent call last):
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15515)
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_34_64.c:5631)
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 764, in do_wait_suspend
    self._activate_mpl_if_needed()
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 416, in _activate_mpl_if_needed
    activate_function()
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 407, in <lambda>
    self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 93, in activate_matplotlib
    is_interactive = is_interactive_backend(backend)
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 56, in is_interactive_backend
    from matplotlib.rcsetup import interactive_bk, non_interactive_bk  # @UnresolvedImport
ImportError: cannot import name 'interactive_bk'
Traceback (most recent call last):
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1621, in <module>
    main()
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1615, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1022, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\_pydev_imps\_pydev_execfile.py", line 25, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:\Mahesh\workspaces\pyworkspace\Analytics Python\python_server\server.py", line 84, in <module>
    start_server()
  File "D:\Mahesh\workspaces\pyworkspace\Analytics Python\python_server\server.py", line 84, in <module>
    start_server()
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 982, in _pydevd_bundle.pydevd_cython_win32_34_64.SafeCallWrapper.__call__ (_pydevd_bundle/pydevd_cython_win32_34_64.c:19346)
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 498, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:18639)
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 750, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15669)
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15515)
  File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_34_64.c:5631)
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 764, in do_wait_suspend
    self._activate_mpl_if_needed()
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 416, in _activate_mpl_if_needed
    activate_function()
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 407, in <lambda>
    self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 93, in activate_matplotlib
    is_interactive = is_interactive_backend(backend)
  File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 56, in is_interactive_backend
    from matplotlib.rcsetup import interactive_bk, non_interactive_bk  # @UnresolvedImport
ImportError: cannot import name 'interactive_bk'

Why is this happening? 为什么会这样呢? (I am using python 3.4, eclipse oxygen 4.7 and PyDev 6.2.0.201711281614) (我正在使用python 3.4,eclipse oxygen 4.7和PyDev 6.2.0.201711281614)

Apparently the problem is because pydev is expecting matplotlib to have some modules which aren't available in your installation... so, the import: 显然问题是因为pydev期望matplotlib包含一些在您的安装中不可用的模块...因此,导入:

from matplotlib.rcsetup import interactive_bk, non_interactive_bk # @UnresolvedImport

is failing (and that's expected in PyDev if you have matplotlib installed). 失败(如果安装了matplotlib,这在PyDev中是预期的)。

Not sure why... I need to investigate whether you have a broken matplotlib or if matplotlib actually changed (in which case the pydev debugger would need to be fixed). 不知道为什么...我需要调查您是否有损坏的matplotlib或matplotlib是否实际更改(在这种情况下,需要修复pydev调试器)。

Can you add details on the matplotlib version you have? 您可以添加有关matplotlib版本的详细信息吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM