Pycharm:如何为标准终端启动(解决诅咒问题) [英] Pycharm : how-to launch for a standard terminal (to solve an issue with curses)
问题描述
我遇到了一个奇怪的问题.使用 Pycharm(请不要谈论这个事实),我正在尝试启动一个简短的应用程序,该应用程序使用 ncurses
在我的任期内呈现一些内容.
虽然我可以用简单的术语启动项目而没有任何问题,但从 Pycharm 启动它会引发以下错误:
文件/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/__init__.py",第33行,在initscr中fd=_sys.__stdout__.fileno())错误:setupterm:找不到终端进程已完成,退出代码为 0
据我所知,一切都与终端环境变量有关.Pycharm 从它自己的终端实例启动项目(运行或调试),curses 将无法使用它.所以,我想知道如何配置 Pycharm 以在常规终端内启动我的项目.
该项目使用的是 Python 2.7.Pycharm 的 EAP 版本为 129.258(不适用于其他版本,包括稳定版)
感谢您的关注.
K.
我通过将调试器附加到进程来解决了 Curses 调试问题.
- 在终端中启动程序
- Pycharm -> 工具 -> 附加到进程
- 选择我的程序
- 完成
尝试以非 root 身份附加需要额外的 ptrace 访问权限.
在我的 ubuntu 机器上:echo 0 >/proc/sys/kernel/yama/ptrace_scope
(作为 root)
在/etc/sysctl.d/10-ptrace.conf中分别设置ptrace_scope为0
I'm facing a weird problem.
Using Pycharm (please do not troll about this fact), I'm trying to launch a short app that uses ncurses
to render some things on my term.
While I can launch the project in a simple term without any problem, launching it from Pycharm raise the following error :
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
As far as I can see, all is about terminal environment variables. Pycharm launch the project (Run or Debug) from its own instance of the terminal, and curses will not work with it. So, I am wondering how may I configure Pycharm to launch my project inside a regular terminal.
The project is using Python 2.7. Pycharm is in EAP version 129.258 (doesn't work with other versions, including stables)
Thanks for your attention.
K.
I solved the curses debugging problem by attaching the debugger to a process.
- Start the program in a terminal
- Pycharm -> Tools -> Attach to Process
- Select my prog
- Done
Trying to attach as non-root requires additional ptrace access rights.
Explained here: http://blog.mellenthin.de/archives/2010/10/18/gdb-attach-fails-with-ptrace-operation-not-permitted/#comment-141535
On my ubuntu machine:
echo 0 > /proc/sys/kernel/yama/ptrace_scope
(as root)
respectively set ptrace_scope to 0 in /etc/sysctl.d/10-ptrace.conf
这篇关于Pycharm:如何为标准终端启动(解决诅咒问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!