Registered Member
|
How to set up kdevelop to execute a Python program and get the result on the command line?
Example program:
|
Global Moderator
|
What is the "command line"? Output is by default printed to KDevelops output view, for that just set it up in Run -> Configure launches (add a Script launcher there).
I'm working on the KDevelop IDE.
|
Registered Member
|
I have a similar problem. I can only see the output in the shell once the program is terminated. But if I run an interactive software, and let's say I click a button to print something on the standard output I can't see this output until I terminate the program. At that point I'll see all the outputs together.
|
Global Moderator
|
Call sys.stdout.flush() to make sure your output it flushed to the tty immediately. Otherwise the behaviour is not well-defined wrt when your output appears.
That said, I'm not sure why KDevelop's output view behaves differently from e.g. konsole here.
I'm working on the KDevelop IDE.
|
Registered Member
|
Thanks for the hint.
|
Registered Member
|
Hello to everyone!
Sorry for replying to an old post, but I'm facing the same problem mentioned before. I've been using KDevelop for a while for my researches with digital signal processing using Python, and this IDE can handle all the work, like my old choice (Eclipse/PyDev). KDevelop is very clean and lightweight! And KatePart component rocks! Unfortunately on my Arch Linux, when I run a interactive software through the IDE (not for the embed Konsole), my KDevelop closes showing a drkonqi screen: [bug]kdevelop PID: 6104 Sinal: Segmentation fault (11)[/bug] Even when I call
I've been workaround the problem run the scripts through the embed Konsole, but nothing compares to a short-cut-command script run. How can I overcome this problem? PS.: This problem don't occur with other kinds of applications, e.g. plotting or image processing through OpenCV, etc. Seems only happens to user interaction to tty. |
Global Moderator
|
That is a bug, but we would need the backtrace displayed in drkonqui in order to say anything more.
I'm working on the KDevelop IDE.
|
Registered Member
|
Sorry for that. I save the file, but I forgot to post it. Follows: [bug]Application: KDevelop (kdevelop), signal: Segmentation fault Using host libthread_db library "/usr/lib/libthread_db.so.1". [Current thread is 1 (Thread 0x7f5fcab0cd80 (LWP 14745))] Thread 14 (Thread 0x7f5f58cde700 (LWP 14785)): #0 0x00007f5fc717091b in poll () at /usr/lib/libc.so.6 #1 0x00007f5fbdc41053 in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #4 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #6 0x00007f5f605e3b6a in () at /usr/lib/qt/qml/QtQuick/XmlListModel/libqmlxmllistmodelplugin.so #7 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #8 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #9 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 13 (Thread 0x7f5f596ec700 (LWP 14784)): #0 0x00007f5fc081d39d in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0 #1 0x00007f5fc787400c in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib/libQt5Core.so.5 #2 0x00007f5fbc21142f in ThreadWeaver::Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread*, bool, bool, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #3 0x00007f5fbc216479 in () at /usr/lib/libKF5ThreadWeaver.so.5 #4 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #5 0x00007f5fbc2164d2 in () at /usr/lib/libKF5ThreadWeaver.so.5 #6 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #7 0x00007f5fbc2164d2 in () at /usr/lib/libKF5ThreadWeaver.so.5 #8 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #9 0x00007f5fbc2164d2 in () at /usr/lib/libKF5ThreadWeaver.so.5 #10 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #11 0x00007f5fbc2164d2 in () at /usr/lib/libKF5ThreadWeaver.so.5 #12 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #13 0x00007f5fbc213c83 in ThreadWeaver::Thread::run() () at /usr/lib/libKF5ThreadWeaver.so.5 #14 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #15 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #16 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 12 (Thread 0x7f5f59eed700 (LWP 14783)): #0 0x00007f5fc081d39d in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0 #1 0x00007f5fc787400c in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib/libQt5Core.so.5 #2 0x00007f5fbc21142f in ThreadWeaver::Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread*, bool, bool, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #3 0x00007f5fbc216479 in () at /usr/lib/libKF5ThreadWeaver.so.5 #4 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #5 0x00007f5fbc2164d2 in () at /usr/lib/libKF5ThreadWeaver.so.5 #6 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #7 0x00007f5fbc213c83 in ThreadWeaver::Thread::run() () at /usr/lib/libKF5ThreadWeaver.so.5 #8 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #9 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #10 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 11 (Thread 0x7f5f5a6ee700 (LWP 14782)): #0 0x00007f5fc081d39d in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0 #1 0x00007f5fc787400c in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib/libQt5Core.so.5 #2 0x00007f5fbc21142f in ThreadWeaver::Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread*, bool, bool, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #3 0x00007f5fbc216479 in () at /usr/lib/libKF5ThreadWeaver.so.5 #4 0x00007f5fbc210924 in ThreadWeaver::Weaver::applyForWork(ThreadWeaver::Thread*, bool) () at /usr/lib/libKF5ThreadWeaver.so.5 #5 0x00007f5fbc213c83 in ThreadWeaver::Thread::run() () at /usr/lib/libKF5ThreadWeaver.so.5 #6 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #7 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #8 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 10 (Thread 0x7f5f5aeef700 (LWP 14781)): #0 0x00007f5fbdc87bd9 in g_mutex_lock () at /usr/lib/libglib-2.0.so.0 #1 0x00007f5fbdc40585 in g_main_context_prepare () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc40f7e in () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #4 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #7 0x00007f5fc5375302 in () at /usr/lib/libKDevPlatformLanguage.so.52 #8 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #9 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #10 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 9 (Thread 0x7f5f6a50e700 (LWP 14763)): #0 0x00007f5fc716c3d8 in read () at /usr/lib/libc.so.6 #1 0x00007f5fbdc86831 in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc40b28 in g_main_context_check () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fbdc40ff6 in () at /usr/lib/libglib-2.0.so.0 #4 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #5 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #7 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #8 0x00007f5fc5375302 in () at /usr/lib/libKDevPlatformLanguage.so.52 #9 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #10 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #11 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 8 (Thread 0x7f5f78bd5700 (LWP 14757)): #0 0x00007f5fc717091b in poll () at /usr/lib/libc.so.6 #1 0x00007f5fbdc41053 in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #4 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #7 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #8 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 7 (Thread 0x7f5f73fff700 (LWP 14756)): #0 0x00007f5fc716c3d8 in read () at /usr/lib/libc.so.6 #1 0x00007f5fbdc86831 in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc40b28 in g_main_context_check () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fbdc40ff6 in () at /usr/lib/libglib-2.0.so.0 #4 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #5 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #7 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #8 0x00007f5fc0298a19 in () at /usr/lib/libQt5Qml.so.5 #9 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #10 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #11 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 6 (Thread 0x7f5f79c87700 (LWP 14750)): #0 0x00007f5fc717091b in poll () at /usr/lib/libc.so.6 #1 0x00007f5fbdc41053 in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #4 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #7 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #8 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 5 (Thread 0x7f5f7c4a3700 (LWP 14749)): #0 0x00007f5fc081d39d in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0 #1 0x00007f5fc74ef5bd in __gthread_cond_wait (__mutex=<optimized out>, __cond=<optimized out>) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:864 #2 0x00007f5fc74ef5bd in std::condition_variable::wait(std::unique_lock<std::mutex>&) (this=<optimized out>, __lock=...) at /build/gcc/src/gcc/libstdc++-v3/src/c++11/condition_variable.cc:53 #3 0x00007f5f7f50faa9 in () at /usr/lib/libQt5WebKit.so.5 #4 0x00007f5f7f50fbf9 in () at /usr/lib/libQt5WebKit.so.5 #5 0x00007f5fc74f5b9f in std::execute_native_thread_routine(void*) (__p=0x5619a9105500) at /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:83 #6 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #7 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 4 (Thread 0x7f5f88096700 (LWP 14748)): #0 0x00007f5fbdc4055c in g_main_context_prepare () at /usr/lib/libglib-2.0.so.0 #1 0x00007f5fbdc40f7e in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #4 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc525e921 in () at /usr/lib/libKDevPlatformLanguage.so.52 #7 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #8 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #9 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 3 (Thread 0x7f5f92d30700 (LWP 14747)): #0 0x00007f5fc717091b in poll () at /usr/lib/libc.so.6 #1 0x00007f5fbdc41053 in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f5fc7abb6b4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #4 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc786d78e in QThread::exec() () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fc97ff416 in () at /usr/lib/libQt5DBus.so.5 #7 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #8 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #9 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 2 (Thread 0x7f5f9c46a700 (LWP 14746)): #0 0x00007f5fc717091b in poll () at /usr/lib/libc.so.6 #1 0x00007f5fb30398e0 in () at /usr/lib/libxcb.so.1 #2 0x00007f5fb303b679 in xcb_wait_for_event () at /usr/lib/libxcb.so.1 #3 0x00007f5f9e9857aa in () at /usr/lib/libQt5XcbQpa.so.5 #4 0x00007f5fc7872b2d in () at /usr/lib/libQt5Core.so.5 #5 0x00007f5fc081708c in start_thread () at /usr/lib/libpthread.so.0 #6 0x00007f5fc717ae1f in clone () at /usr/lib/libc.so.6 Thread 1 (Thread 0x7f5fcab0cd80 (LWP 14745)): [KCrash Handler] #5 0x00007f5fc795d918 in QDebug::putString(QChar const*, unsigned long) () at /usr/lib/libQt5Core.so.5 #6 0x00007f5fca71577d in () at /usr/lib/libKDevPlatformShell.so.52 #7 0x00007f5fc7a8fb2f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5 #8 0x00007f5fc79d8552 in QProcess::errorOccurred(QProcess::ProcessError) () at /usr/lib/libQt5Core.so.5 #9 0x00007f5fc79df591 in () at /usr/lib/libQt5Core.so.5 #10 0x00007f5fc79e4835 in () at /usr/lib/libQt5Core.so.5 #11 0x00007f5fc79d9d6c in QProcess::waitForFinished(int) () at /usr/lib/libQt5Core.so.5 #12 0x00007f5fc79da6f2 in QProcess::~QProcess() () at /usr/lib/libQt5Core.so.5 #13 0x00007f5fc8f1680a in KProcess::~KProcess() () at /usr/lib/libKF5CoreAddons.so.5 #14 0x00007f5fc7a8d54d in QObjectPrivate::deleteChildren() () at /usr/lib/libQt5Core.so.5 #15 0x00007f5fc7a9717c in QObject::~QObject() () at /usr/lib/libQt5Core.so.5 #16 0x00007f5f68ec03f4 in () at /usr/lib/qt/plugins/kdevplatform/30/kdevexecutescript.so #17 0x00007f5fc7a90471 in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5 #18 0x00007f5fc87d9e3c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5 #19 0x00007f5fc87e1816 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5 #20 0x00007f5fc7a5f1e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5 #21 0x00007f5fc7a61e46 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5 #22 0x00007f5fc7abc0a4 in () at /usr/lib/libQt5Core.so.5 #23 0x00007f5fbdc40e98 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0 #24 0x00007f5fbdc410e1 in () at /usr/lib/libglib-2.0.so.0 #25 0x00007f5fbdc4116e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #26 0x00007f5fc7abb691 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #27 0x00007f5f9ea0d282 in () at /usr/lib/libQt5XcbQpa.so.5 #28 0x00007f5fc7a5d82b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5 #29 0x00007f5fc7a66b18 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5 #30 0x00005619a68faa3c in () #31 0x00007f5fc70a5f4a in __libc_start_main () at /usr/lib/libc.so.6 #32 0x00005619a68fafea in _start () [/bug] Thanks in advance. |
Global Moderator
|
Hmm, I cannot reproduce that issue, and the trace doesn't really tell me what's wrong :/
Can you try with the AppImage ...?
I'm working on the KDevelop IDE.
|
Registered Member
|
When I tried the AppImage, I had to stop running the script, because nothing more happens, and KDevelop closes. Follows the output from Konsole:
|
Global Moderator
|
Hm, if you can reproduce it with the AppImage, then I should be able to reproduce it too. Do you have the script available? Maybe it's something specific to do?
I'm working on the KDevelop IDE.
|
Registered Member
|
Yes! This is my script. This is just a simple calculator that I used for this tests, but any other interactive scripts that I run shows the same problem.
Thanks for the quick replies. |
Global Moderator
|
Thanks! Further discussion / updates here: https://phabricator.kde.org/D9858
I'm working on the KDevelop IDE.
|
Registered Member
|
Thank you scummos! I'll follow the updates with attention. |
Global Moderator
|
Should be fixed now, http://home.kfunk.org:8080/job/kdevelop ... ge-centos/ should will build a new AppImage tomorrow.
I'm working on the KDevelop IDE.
|
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]