小编new*_*bie的帖子

PyCharm输出错误消息穿插在控制台输出中.如何解决这个问题?

我正在运行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([])所有我的代码的功能部分内发生.所有这些之后应出现错误消息.

python pycharm

19
推荐指数
2
解决办法
1727
查看次数

尝试使用execvpe(...)但得到隐式声明错误 - 即使我认为我正在使用正确的参数类型

我编译时收到以下警告:

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)

Linux手册页中所述

以下是我的代码的相关部分:

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

c linux posix exec unistd.h

4
推荐指数
1
解决办法
5774
查看次数

标签 统计

c ×1

exec ×1

linux ×1

posix ×1

pycharm ×1

python ×1

unistd.h ×1