【问题标题】:IDLE fails to open for debug build on windowsIDLE 无法在 Windows 上打开调试构建
【发布时间】:2013-11-30 07:55:37
【问题描述】:

我从 http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz 下载了源代码,并在 http://docs.python.org/devguide/setup.html 的说明的帮助下,我能够从源代码构建 Python。

现在尝试运行命令时

C:\Python-2.7.6\PCbuild\pythonw_d.exe c:\Python-2.7.6\Lib\idlelib\idle.py

什么都没有出现。

于是我开始调试,首先通过以下代码 sn-p 向 Windows 应用程序添加一个控制台到pythonw\WInMain.c

void RedirectStdoutToNewCOnsole()
{
    HANDLE consoleHandle;
    FILE *fp;
    int fileDescriptor;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    AllocConsole();
    consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
    fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
    fp = _fdopen( fileDescriptor, "w" );
    *stdout = *fp;
    setvbuf( stdout, NULL, _IONBF, 0 );        
    if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
    {
        COORD bufferSize;
        bufferSize.X = csbi.dwSize.X;
        bufferSize.Y = 1000;
        SetConsoleScreenBufferSize(consoleHandle, bufferSize);
    }
}

我能够看到源被正确解析

Token NAME/'import' ... It's a keyword
 DFA 'file_input', state 0: Push ...
 DFA 'stmt', state 0: Push ...
 DFA 'simple_stmt', state 0: Push ...
 DFA 'small_stmt', state 0: Push ...
 DFA 'import_stmt', state 0: Push ...
 DFA 'import_name', state 0: Shift.
Token NAME/'os' ... It's a token we know
 DFA 'import_name', state 1: Push ...
 DFA 'dotted_as_names', state 0: Push ...
 DFA 'dotted_as_name', state 0: Push ...
 DFA 'dotted_name', state 0: Shift.
Token DOT/'.' ... It's a token we know
 DFA 'dotted_name', state 1: Shift.
Token NAME/'path' ... It's a token we know
 DFA 'dotted_name', state 0: Shift.
Token NEWLINE/'' ... It's a token we know
 DFA 'dotted_name', state 1: Pop ...
 DFA 'dotted_as_name', state 1: Pop ...
 DFA 'dotted_as_names', state 1: Pop ...
 DFA 'import_name', state 2: Pop ...
 DFA 'import_stmt', state 1: Pop ...
 DFA 'small_stmt', state 1: Pop ...
 DFA 'simple_stmt', state 1: Shift.
  DFA 'simple_stmt', state 3: Direct pop.
  DFA 'stmt', state 1: Direct pop.
Token NAME/'import' ... It's a keyword
 DFA 'file_input', state 0: Push ...
 DFA 'stmt', state 0: Push ...
 DFA 'simple_stmt', state 0: Push ...
 DFA 'small_stmt', state 0: Push ...
 DFA 'import_stmt', state 0: Push ...
 DFA 'import_name', state 0: Shift.
Token NAME/'sys' ... It's a token we know
 DFA 'import_name', state 1: Push ...
 DFA 'dotted_as_names', state 0: Push ...
 DFA 'dotted_as_name', state 0: Push ...
 DFA 'dotted_name', state 0: Shift.
Token NEWLINE/'' ... It's a token we know
 DFA 'dotted_name', state 1: Pop ...
 DFA 'dotted_as_name', state 1: Pop ...
 DFA 'dotted_as_names', state 1: Pop ...
 DFA 'import_name', state 2: Pop ...
 DFA 'import_stmt', state 1: Pop ...
 DFA 'small_stmt', state 1: Pop ...
 DFA 'simple_stmt', state 1: Shift.
  DFA 'simple_stmt', state 3: Direct pop.
  DFA 'stmt', state 1: Direct pop.
Token NAME/'idlelib_dir' ... It's a token we kno
 DFA 'file_input', state 0: Push ...
 DFA 'stmt', state 0: Push ...
 DFA 'simple_stmt', state 0: Push ...
 DFA 'small_stmt', state 0: Push ...
 DFA 'expr_stmt', state 0: Push ...
 DFA 'testlist', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token EQUAL/'=' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'testlist', state 1: Pop ...
 DFA 'expr_stmt', state 1: Shift.
Token NAME/'os' ... It's a token we know
 DFA 'expr_stmt', state 3: Push ...
 DFA 'testlist', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'path' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'dirname' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token LPAR/'(' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'os' ... It's a token we know
 DFA 'trailer', state 1: Push ...
 DFA 'arglist', state 0: Push ...
 DFA 'argument', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'path' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'dirname' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token LPAR/'(' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'os' ... It's a token we know
 DFA 'trailer', state 1: Push ...
 DFA 'arglist', state 0: Push ...
 DFA 'argument', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'path' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'abspath' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token LPAR/'(' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'__file__' ... It's a token we know
 DFA 'trailer', state 1: Push ...
 DFA 'arglist', state 0: Push ...
 DFA 'argument', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token RPAR/')' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'argument', state 1: Pop ...
 DFA 'arglist', state 1: Pop ...
 DFA 'trailer', state 4: Shift.
  DFA 'trailer', state 5: Direct pop.
Token RPAR/')' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'argument', state 1: Pop ...
 DFA 'arglist', state 1: Pop ...
 DFA 'trailer', state 4: Shift.
  DFA 'trailer', state 5: Direct pop.
Token RPAR/')' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'argument', state 1: Pop ...
 DFA 'arglist', state 1: Pop ...
 DFA 'trailer', state 4: Shift.
  DFA 'trailer', state 5: Direct pop.
Token NEWLINE/'' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'testlist', state 1: Pop ...
 DFA 'expr_stmt', state 5: Pop ...
 DFA 'small_stmt', state 1: Pop ...
 DFA 'simple_stmt', state 1: Shift.
  DFA 'simple_stmt', state 3: Direct pop.
  DFA 'stmt', state 1: Direct pop.
Token NAME/'sys' ... It's a token we know
 DFA 'file_input', state 0: Push ...
 DFA 'stmt', state 0: Push ...
 DFA 'simple_stmt', state 0: Push ...
 DFA 'small_stmt', state 0: Push ...
 DFA 'expr_stmt', state 0: Push ...
 DFA 'testlist', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'path' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'insert' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token LPAR/'(' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NUMBER/'0' ... It's a token we know
 DFA 'trailer', state 1: Push ...
 DFA 'arglist', state 0: Push ...
 DFA 'argument', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token COMMA/',' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'argument', state 1: Pop ...
 DFA 'arglist', state 1: Shift.
Token NAME/'idlelib_dir' ... It's a token we kno
 DFA 'arglist', state 4: Push ...
 DFA 'argument', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token RPAR/')' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'argument', state 1: Pop ...
 DFA 'arglist', state 1: Pop ...
 DFA 'trailer', state 4: Shift.
  DFA 'trailer', state 5: Direct pop.
Token NEWLINE/'' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'testlist', state 1: Pop ...
 DFA 'expr_stmt', state 1: Pop ...
 DFA 'small_stmt', state 1: Pop ...
 DFA 'simple_stmt', state 1: Shift.
  DFA 'simple_stmt', state 3: Direct pop.
  DFA 'stmt', state 1: Direct pop.
Token NAME/'import' ... It's a keyword
 DFA 'file_input', state 0: Push ...
 DFA 'stmt', state 0: Push ...
 DFA 'simple_stmt', state 0: Push ...
 DFA 'small_stmt', state 0: Push ...
 DFA 'import_stmt', state 0: Push ...
 DFA 'import_name', state 0: Shift.
Token NAME/'idlelib' ... It's a token we know
 DFA 'import_name', state 1: Push ...
 DFA 'dotted_as_names', state 0: Push ...
 DFA 'dotted_as_name', state 0: Push ...
 DFA 'dotted_name', state 0: Shift.
Token DOT/'.' ... It's a token we know
 DFA 'dotted_name', state 1: Shift.
Token NAME/'PyShell' ... It's a token we know
 DFA 'dotted_name', state 0: Shift.
Token NEWLINE/'' ... It's a token we know
 DFA 'dotted_name', state 1: Pop ...
 DFA 'dotted_as_name', state 1: Pop ...
 DFA 'dotted_as_names', state 1: Pop ...
 DFA 'import_name', state 2: Pop ...
 DFA 'import_stmt', state 1: Pop ...
 DFA 'small_stmt', state 1: Pop ...
 DFA 'simple_stmt', state 1: Shift.
  DFA 'simple_stmt', state 3: Direct pop.
  DFA 'stmt', state 1: Direct pop.
Token NAME/'idlelib' ... It's a token we know
 DFA 'file_input', state 0: Push ...
 DFA 'stmt', state 0: Push ...
 DFA 'simple_stmt', state 0: Push ...
 DFA 'small_stmt', state 0: Push ...
 DFA 'expr_stmt', state 0: Push ...
 DFA 'testlist', state 0: Push ...
 DFA 'test', state 0: Push ...
 DFA 'or_test', state 0: Push ...
 DFA 'and_test', state 0: Push ...
 DFA 'not_test', state 0: Push ...
 DFA 'comparison', state 0: Push ...
 DFA 'expr', state 0: Push ...
 DFA 'xor_expr', state 0: Push ...
 DFA 'and_expr', state 0: Push ...
 DFA 'shift_expr', state 0: Push ...
 DFA 'arith_expr', state 0: Push ...
 DFA 'term', state 0: Push ...
 DFA 'factor', state 0: Push ...
 DFA 'power', state 0: Push ...
 DFA 'atom', state 0: Shift.
  DFA 'atom', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'PyShell' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token DOT/'.' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token NAME/'main' ... It's a token we know
 DFA 'trailer', state 3: Shift.
  DFA 'trailer', state 5: Direct pop.
Token LPAR/'(' ... It's a token we know
 DFA 'power', state 1: Push ...
 DFA 'trailer', state 0: Shift.
Token RPAR/')' ... It's a token we know
 DFA 'trailer', state 1: Shift.
  DFA 'trailer', state 5: Direct pop.
Token NEWLINE/'' ... It's a token we know
 DFA 'power', state 1: Pop ...
 DFA 'factor', state 2: Pop ...
 DFA 'term', state 1: Pop ...
 DFA 'arith_expr', state 1: Pop ...
 DFA 'shift_expr', state 1: Pop ...
 DFA 'and_expr', state 1: Pop ...
 DFA 'xor_expr', state 1: Pop ...
 DFA 'expr', state 1: Pop ...
 DFA 'comparison', state 1: Pop ...
 DFA 'not_test', state 2: Pop ...
 DFA 'and_test', state 1: Pop ...
 DFA 'or_test', state 1: Pop ...
 DFA 'test', state 1: Pop ...
 DFA 'testlist', state 1: Pop ...
 DFA 'expr_stmt', state 1: Pop ...
 DFA 'small_stmt', state 1: Pop ...
 DFA 'simple_stmt', state 1: Shift.
  DFA 'simple_stmt', state 3: Direct pop.
  DFA 'stmt', state 1: Direct pop.
Token NEWLINE/'' ... It's a token we know
 DFA 'file_input', state 0: Shift.
Token ENDMARKER/'' ... It's a token we know
 DFA 'file_input', state 0: Shift.
  DFA 'file_input', state 1: Direct pop.
  ACCEPT.

并且能够追踪到所有调用

python27_d.dll!PyEval_EvalCodeEx
python27_d.dll!PyEval_EvalCode
python27_d.dll!run_mod
python27_d.dll!PyRun_FileExFlags
python27_d.dll!PyRun_SimpleFileExFlags
python27_d.dll!PyRun_AnyFileExFlags
python27_d.dll!Py_Main

但随后被PyEval_EvalCodeEx的递归调用纠缠。

以前,我尝试通过 procmon 比较 pythonw.exe 的工作版本和 pythonw_d.exe 的失败调试版本的输出,但努力没有成果。

有用的数据

  • 64 位 Windows 7
  • 使用 VC9.0 编译为 32 位应用程序的 Python 2.7.6

需要帮助诊断或调试问题的指导。

【问题讨论】:

  • 您是否也构建了 Tcl/Tk? IDLE 要求这样做。无论如何,我希望你在the Python-Dev mailing list 上会有更好的运气。经常在 Windows 上构建 Python 的人数大约为 0 ;-),但其中大多数人阅读 Python-Dev。
  • 认为这可能会有所帮助。试试看stackoverflow.com/questions/445595/…

标签: python debugging python-2.7 python-idle


【解决方案1】:

尝试创建 C: 目录的路径,方法是转到 控制面板 > 系统和维护 > 高级系统设置 > 系统属性 > 环境变量 > 然后转到路径并添加分号,然后是安装python的位置。然后调试。

【讨论】:

    【解决方案2】:

    您是否尝试过自上而下的方法?

    开始单步调试代码。 pdb 就像 guis 的魅力一样!如果您不了解 pdb,只需将其视为普通的 >>> 和 gdb 组合。

    所以你可以 print(locals()) 并进行大量的调试,许多 gui 调试器都窒息了。

    C:\Python-2.7.6\PCbuild\pythonw_d.exe -m pdb c:\Python-2.7.6\Lib\idlelib\idle.py
    
    (Pdb) help
    
    Documented commands (type help lt topic gt):
    ========================================
    EOF    cl         disable  interact  next     return  u          where
    a      clear      display  j         p        retval  unalias
    alias  commands   down     jump      pp       run     undisplay
    args   condition  enable   l         print    rv      unt
    b      cont       exit     list      q        s       until
    break  continue   h        ll        quit     source  up
    bt     d          help     longlist  r        step    w
    c      debug      ignore   n         restart  tbreak  whatis
    
    Miscellaneous help topics:
    ==========================
    pdb  exec
    

    【讨论】:

      【解决方案3】:

      作为一名在 Windows 上从事 IDLE 工作的 Python 核心开发人员,我经常为当前的 Python 版本构建 Python 并运行存储库 IDLE。这就是我所做的。

      1. 构建:我从存储库构建新的拉取。我使用 python.org 开发指南中推荐的免费 MS Visual Studio 编译器。对于 2.7,这个 VS2008。我安装了一个最小的 svn 客户端来获取外部依赖项。我使用带有 -e、-d 选项的 PcBuild/build.bat。这可能是新的,因为这个问题被提出并且一直有效,并且是对前一种方法的巨大改进。当我第一次运行 python_d.exe(3.x 中的 win32/python_d.exe)时,我将它固定到任务栏。固定图标继续适用于后续重建。

      2. Running IDLE:我一般点击python_d.exe图标,输入>>> import idlelib.idle。交互式 Python 控制台会收到警告和错误消息。在控制台中,path\to\python_d.exe -m idlelib.idle.idle 在 3.x 中不需要)比输入完整的 idlelib.idle 路径更容易。

      3. 静默故障:大多数已在过去几年中通过防止故障或添加错误消息得到修复。对于旧版本,可以尝试删除$HOME/.idlerc 中的文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-01-27
        • 1970-01-01
        • 1970-01-01
        • 2022-12-03
        • 1970-01-01
        • 1970-01-01
        • 2017-07-26
        相关资源
        最近更新 更多