- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我遇到了一个奇怪的问题。使用 Pycharm(请不要 mock 这个事实),我正在尝试启动一个简短的应用程序,该应用程序使用 ncurses
在我的任期内呈现一些东西。
虽然我可以在一个简单的术语中毫无问题地启动该项目,但从 Pycharm 启动它会引发以下错误:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/__init__.py", line 33, in initscr
fd=_sys.__stdout__.fileno())
error: setupterm: could not find terminal
Process finished with exit code 0
据我所知,都是关于终端环境变量的。 Pycharm 从它自己的终端实例启动项目(运行或调试),并且 curses 将无法使用它。所以,我想知道如何配置 Pycharm 以在常规终端内启动我的项目。
该项目使用 Python 2.7。Pycharm 的 EAP 版本为 129.258(不适用于其他版本,包括稳定版)
感谢您的关注。
K.
最佳答案
我通过将调试器附加到进程解决了 curses 调试问题。
尝试以非 root 身份附加需要额外的 ptrace 访问权限。
在我的 ubuntu 机器上:echo 0 >/proc/sys/kernel/yama/ptrace_scope
(作为 root)
在/etc/sysctl.d/10-ptrace.conf中分别设置ptrace_scope为0
关于python - : how-to launch for a standard terminal (to solve an issue with curses),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17008372/
我正在查看一本书中的一些源代码并注意到一些代码似乎不在当前的 Python2.7 API 中。根据这段代码,模块 curses 应该有一个名为 LINES 的常量变量和另一个名为 COLS 的常量变量
#include using namespace std; #include //#include int main() { initscr();
我正在尝试在一个使用 Curses 库的简单窗口中实现删除字符。 基本上,窗口是使用以下边框代码创建的: box(local_win, 0 , 0); // Set the border of the
当您启动(n)curses程序时,它将从终端模拟器中删除滚动条,清除屏幕,滚动日志(历史记录)也将消失。当退出程序时,屏幕内容重新出现,滚动条返回,滚动缓冲区返回。 ncurses 是如何实现的?我研
我目前正在尝试为我的程序运行一个小型控制台菜单。我在PyPi curses-menu上找到了curses-menu模块并尝试了我的运气。 curses 菜单有一个 FunctionItem ,它调用
我通过 Linux Mint 的 Xfce 终端 ssh(也尝试过 ssh -t)连接到运行 Rasperian Stretch 的 Raspberry Pi。在 Pi 上,我有一个 Python-C
我正在用 python curses 开发一个应用程序。我正在使用 getch() 方法来获取按下的键。但我可以在屏幕上看到按下的键。我可以随时移动光标,但在光标之后我可以看到用户输入的内容。 当然,
有一个简单的程序: import curses import time window = curses.initscr() curses.cbreak() window.nodelay(True) w
我对 curses 很陌生,但我写了一个可以工作的小 curses 应用程序。但过了一会儿,我注意到我的默认终端设置在 session 期间发生了变化。背景颜色是纯黑色,但我配置了一个透明终端。而且颜
#! /usr/bin/python import curses import curses.textpad as textpad try: mainwindow = curses.inits
我正在尝试为我的 curses 输出添加颜色。然而,挑战在于文本是通过单个长字符串打印的,即 self.all_results。有什么方法可以为字符串的单个部分添加颜色。 def main(self,
我正在尝试在诅咒程序中实现上下滚动,目前我只是想捕捉事件并显示它的数字: MEVENT event; mousemask(ALL_MOUSE_EVENTS, NULL); while (ch != 1
我在使用 Curses 模块检测退格键时遇到了困难。每当我按下 Backspace 键时,返回的字符/字符串都是“^?”,但是我无法通过以下方式检测到它: 如果 str(key) == '^?': 下
我现在非常非常困惑...... 基本上试图声明一个指向curses窗口的全局变量,以便我可以使用调试命令,但它提示AttributeError:'NoneType'对象没有属性'addstr'这意味着
我很难理解 window.timeout() 函数。更具体地说,我正在玩 python 中的“贪吃蛇”游戏: s = curses.initscr() curses.curs_set(0) w = c
我有一个 curses 菜单,我想在上面添加多行描述。 我的代码打开了描述字段,但如果它们不适合该行则不会显示。 Curses 很乐意将多行文本打印为字符串(而不是菜单描述) 关于如何使多行描述有效的
我有以下代码,可让您上下滚动一段文本。每次滚动(即处理用户输入)时,键盘都会按预期更新。然而,在按下第一个键之前,没有任何显示,尽管我正在调用 pad.refresh() 就像我在每次用户输入后所做的
我正在调用 python -m pdb myapp.py,当异常触发时,我通常会返回到 pdb 解释器来调查问题。但是,在我通过 curses.wrapper() 调用并进入 curses 模式后抛出
我使用 curses 为我的应用程序创建了一个简单的 UI,我还使用层级结构(logmain、logmain.child1)等在我的模块中包含日志(日志记录)。 如果发生日志事件,日志将显示在我的 U
我正在学习 Curses 类(class),但无法控制 ENTER 键。到目前为止,这是我的代码: require 'curses' win = Curses::Window.new(0, 0, 0,
我是一名优秀的程序员,十分优秀!