IDLE在Windows上无法打开调试版本

5
我从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

页面没有显示出来。

于是我开始调试,首先通过以下代码片段将控制台添加到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
  • Python 2.7.6编译为32位应用程序,使用VC9.0

需要帮助诊断或指导解决问题。


3
你也构建了Tcl/Tk吗?IDLE需要它。无论如何,我预计你会在Python-Dev邮件列表上更容易获得帮助。通常在Windows上构建Python的人数大约为0 ;-),但其中大多数人都阅读Python-Dev。 - Tim Peters
想必这会有所帮助。试一试吧。https://dev59.com/vnRB5IYBdhLWcg3w-8Ho - raj3209812
3个回答

0

尝试通过以下步骤在控制面板中创建到 C: 目录的路径:进入控制面板 > 系统和维护 > 高级系统设置 > 系统属性 > 环境变量 > 然后进入 Path(路径) 并添加一个分号,接着输入安装 Python 的位置。然后开始调试。


0
你尝试过自上而下的方法吗?
只需开始逐步执行代码。pdb与guis完美配合!如果您不知道pdb,只需将其视为正常的>>>和gdb组合即可。
因此,您可以打印(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

0
作为 Python 核心开发人员,在 Windows 上从事 IDLE 相关工作,我经常编译和运行 Python 以及当前版本的仓库 IDLE。以下是我的操作步骤:
建立:我从存储库构建新的拉取请求。我使用python.org devguide中提供的推荐免费MS Visual Studio编译器。对于2.7,这是VS2008。我安装了最小的svn客户端以获取外部依赖项。我使用PcBuild / build.bat以-e、-d选项构建。自此问答发布以来,这可能是新内容,并且始终有效,是对以前方法的重大改进。当我第一次运行python_d.exe(3.x中的win32/python_d.exe),我将其固定到任务栏上。固定的图标在后续重建中仍然有效。
运行IDLE:我通常单击python_d.exe图标并输入“import idlelib.idle”。交互式Python控制台会收到警告和错误消息。在控制台中,“path\to\python_d.exe -m idlelib.idle”(3.x中不需要“.idle”)比键入完整的idlelib.idle路径更容易。
静默失败:大多数已在过去几年中修复,可以通过防止失败或添加错误消息来实现修复。对于旧版本,可以尝试删除“$HOME/.idlerc”中的文件。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接