我正在运行PyCharm Community Edition 4.0.4
有谁知道控制台输出后为什么不显示错误消息?
谢谢
C:\Python27\python.exe "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py"
Traceback (most recent call last):
START
File "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py", line 68, in <module>
print sol.ladderLength('talk', 'tail', set)
Graph:
File "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py", line 54, in ladderLength
hall ['fall']
for item in graph[node[0]]:
fall ['hall']
KeyError: 'talk'
End Graph:
Visited = {'talk': 0}
Node = ['talk', 0]
Queue Before = deque([])
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
如果你会注意到,报表打印等START,Graph:,hall ['fall'],多达Queue Before = deque([])所有我的代码的功能部分内发生.所有这些之后应出现错误消息.
我编译时收到以下警告:
execute.c:20:2: warning: implicit declaration of function ‘execvpe’[-Wimplicit-function-declaration] execvpe("ls", args, envp);
Run Code Online (Sandbox Code Playgroud)
^
我的理解是,当您尝试使用的函数具有不正确类型的参数时,会发生这种情况.但是,我很确定我正在提供正确的参数:
int execvpe(const char *file, char *const argv[], char *const envp[]);
Run Code Online (Sandbox Code Playgroud)
以下是我的代码的相关部分:
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
void test_execvpe(char* envp[])
{
const char* temp = getenv("PATH");
char path[strlen(temp)+1];
strcpy(path, temp);
printf("envp[%d] = %s\n", 23, envp[23]); //print PATH
char* args[] = {"-l", "/usr", (char*) NULL};
execvpe("ls", args, envp);
}
int main( int argc, char* argv[], char* envp[])
{
//test_execlp();
test_execvpe(envp); …Run Code Online (Sandbox Code Playgroud)