0

Colleague provided me set of py files for testing, which are running fine on his machine. However when I run the py files, I am getting following error:

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. So I added that import (even though eclipse says "unused import"), but still getting the same error. 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)

Mahesha999
  • 22,693
  • 29
  • 116
  • 189

1 Answers1

0

Apparently the problem is because pydev is expecting matplotlib to have some modules which aren't available in your installation... so, the import:

from matplotlib.rcsetup import interactive_bk, non_interactive_bk # @UnresolvedImport

is failing (and that's expected in PyDev if you have matplotlib installed).

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).

Can you add details on the matplotlib version you have?

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78