python诅咒setupterm中的远程调试pdevd错误

python诅咒setupterm中的远程调试pdevd错误,python,debugging,ncurses,curses,python-curses,Python,Debugging,Ncurses,Curses,Python Curses,可以在PyCharm中远程调试诅咒程序吗?如何设置它 我按照PyCharm 4.0.8指令,从“npyscreen-4.8.7”中将其添加到“EXAMPLE.py” 并且总是在“setupterm”中遇到错误: 如果用“pdevd”删除两行,则程序成功。它打印出来的“术语”是“xterm” 如果将第一个参数“setupterm”更改为“term='xterm'”,即使使用“pydevd”也会成功 我想问题是如何让pydevd设置正确的术语,而答案之一可能是:更改/usr/lib/python

可以在PyCharm中远程调试诅咒程序吗?如何设置它

我按照PyCharm 4.0.8指令,从“
npyscreen-4.8.7
”中将其添加到“
EXAMPLE.py

并且总是在“
setupterm
”中遇到错误:

  • 如果用“
    pdevd
    ”删除两行,则程序成功。它打印出来的“
    术语
    ”是“
    xterm
  • 如果将第一个参数“
    setupterm
    ”更改为“
    term='xterm'
    ”,即使使用“
    pydevd
    ”也会成功

我想问题是如何让pydevd设置正确的术语,而答案之一可能是:更改
/usr/lib/python2.6/curses/\uu init\uuuuuu.py
,强制使用以下术语:

def initscr():
    import _curses, curses
    # we call setupterm() here because it raises an error
    # instead of calling exit() in error cases.
    _os.environ['TERM'] = 'xterm' ##hack force 'xterm' for pydevd debugging.
    setupterm(term=_os.environ.get("TERM", "unknown"),
              fd=_sys.__stdout__.fileno())
    stdscr = _curses.initscr()
    for key, value in _curses.__dict__.items():
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
            setattr(curses, key, value)

    return stdscr
更改“
术语
”的原始来源如下:

$ head plugins/org.python.pydev_4.0.0.201504132356/pysrc/pydev_ipython_console.py 
import sys
from pydev_console_utils import BaseInterpreterInterface

import os

os.environ['TERM'] = 'emacs' #to use proper page_more() for paging


# Uncomment to force PyDev standard shell.
# raise ImportError()

答案之一可能是:将
/usr/lib/python2.6/curses/\uuu init\uuu.py
更改为强制术语,如:

def initscr():
    import _curses, curses
    # we call setupterm() here because it raises an error
    # instead of calling exit() in error cases.
    _os.environ['TERM'] = 'xterm' ##hack force 'xterm' for pydevd debugging.
    setupterm(term=_os.environ.get("TERM", "unknown"),
              fd=_sys.__stdout__.fileno())
    stdscr = _curses.initscr()
    for key, value in _curses.__dict__.items():
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
            setattr(curses, key, value)

    return stdscr
更改“
术语
”的原始来源如下:

$ head plugins/org.python.pydev_4.0.0.201504132356/pysrc/pydev_ipython_console.py 
import sys
from pydev_console_utils import BaseInterpreterInterface

import os

os.environ['TERM'] = 'emacs' #to use proper page_more() for paging


# Uncomment to force PyDev standard shell.
# raise ImportError()

答案之一可能是:将
/usr/lib/python2.6/curses/\uuu init\uuu.py
更改为强制术语,如:

def initscr():
    import _curses, curses
    # we call setupterm() here because it raises an error
    # instead of calling exit() in error cases.
    _os.environ['TERM'] = 'xterm' ##hack force 'xterm' for pydevd debugging.
    setupterm(term=_os.environ.get("TERM", "unknown"),
              fd=_sys.__stdout__.fileno())
    stdscr = _curses.initscr()
    for key, value in _curses.__dict__.items():
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
            setattr(curses, key, value)

    return stdscr
更改“
术语
”的原始来源如下:

$ head plugins/org.python.pydev_4.0.0.201504132356/pysrc/pydev_ipython_console.py 
import sys
from pydev_console_utils import BaseInterpreterInterface

import os

os.environ['TERM'] = 'emacs' #to use proper page_more() for paging


# Uncomment to force PyDev standard shell.
# raise ImportError()

答案之一可能是:将
/usr/lib/python2.6/curses/\uuu init\uuu.py
更改为强制术语,如:

def initscr():
    import _curses, curses
    # we call setupterm() here because it raises an error
    # instead of calling exit() in error cases.
    _os.environ['TERM'] = 'xterm' ##hack force 'xterm' for pydevd debugging.
    setupterm(term=_os.environ.get("TERM", "unknown"),
              fd=_sys.__stdout__.fileno())
    stdscr = _curses.initscr()
    for key, value in _curses.__dict__.items():
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
            setattr(curses, key, value)

    return stdscr
更改“
术语
”的原始来源如下:

$ head plugins/org.python.pydev_4.0.0.201504132356/pysrc/pydev_ipython_console.py 
import sys
from pydev_console_utils import BaseInterpreterInterface

import os

os.environ['TERM'] = 'emacs' #to use proper page_more() for paging


# Uncomment to force PyDev standard shell.
# raise ImportError()

这些提示指出了pydevd中术语的硬编码设置,这让我想到了这个序列,它对我很有用:

#
# From the instructions in the PyCharm remote debug setup screen,
# add this to your code before curses is initialised.
#
import pydevd
pydevd.settrace('localhost', port=8899)
#
# And then to fixup the broken setting in pydevd...
#
os.environ['TERM'] = 'xterm'

这些提示指出了pydevd中术语的硬编码设置,这让我想到了这个序列,它对我很有用:

#
# From the instructions in the PyCharm remote debug setup screen,
# add this to your code before curses is initialised.
#
import pydevd
pydevd.settrace('localhost', port=8899)
#
# And then to fixup the broken setting in pydevd...
#
os.environ['TERM'] = 'xterm'

这些提示指出了pydevd中术语的硬编码设置,这让我想到了这个序列,它对我很有用:

#
# From the instructions in the PyCharm remote debug setup screen,
# add this to your code before curses is initialised.
#
import pydevd
pydevd.settrace('localhost', port=8899)
#
# And then to fixup the broken setting in pydevd...
#
os.environ['TERM'] = 'xterm'

这些提示指出了pydevd中术语的硬编码设置,这让我想到了这个序列,它对我很有用:

#
# From the instructions in the PyCharm remote debug setup screen,
# add this to your code before curses is initialised.
#
import pydevd
pydevd.settrace('localhost', port=8899)
#
# And then to fixup the broken setting in pydevd...
#
os.environ['TERM'] = 'xterm'

TERM
设置为“emacs”可能是不正确的,除非有人恰好在emacs程序中运行。实际上,IDE控制台需要将其设置为emacs。PyCharm和Eclipse都有,这可能是由于死记硬背造成的。ncurses不提供名为“emacs”的条目(并且不假设已安装)。这在很久以前就被“eterm”项淘汰了。将
TERM
设置为“emacs”可能是不正确的,除非有人碰巧在emacs程序中运行。实际上,IDE控制台需要将其设置为emacs。PyCharm和Eclipse都有,这可能是由于死记硬背造成的。ncurses不提供名为“emacs”的条目(并且不假设已安装)。这在很久以前就被“eterm”项淘汰了。将
TERM
设置为“emacs”可能是不正确的,除非有人碰巧在emacs程序中运行。实际上,IDE控制台需要将其设置为emacs。PyCharm和Eclipse都有,这可能是由于死记硬背造成的。ncurses不提供名为“emacs”的条目(并且不假设已安装)。这在很久以前就被“eterm”项淘汰了。将
TERM
设置为“emacs”可能是不正确的,除非有人碰巧在emacs程序中运行。实际上,IDE控制台需要将其设置为emacs。PyCharm和Eclipse都有,这可能是由于死记硬背造成的。ncurses不提供名为“emacs”的条目(并且不假设已安装)。这在很久以前就被“eterm”条目淘汰了。这看起来不错,但是没有被我验证,尽管我将这个答案设置为接受。谢谢你的回答。这看起来不错,但我没有验证,虽然我把这个答案设置为接受。谢谢你的回答。这看起来不错,但我没有验证,虽然我把这个答案设置为接受。谢谢你的回答。这看起来不错,但我没有验证,虽然我把这个答案设置为接受。谢谢你的回答。