Pydev Eclipse console does not support curses.setupterm - console

I cannot run a script in Eclipse that works perfectly in a terminal.
It seems that Eclipse console cannot support some functions. I am looking for a workaround to be able to debug the script using Pydev.
Is it possible to set PyDev to use for example /usr/bin/gnome-terminal instead of the Eclipse native console ?
Otherwise it there a way to define a wrapper as a python interpreter for PyDev that will launch an terminal external to Eclipse (I've tried but failed on that).
Thank you
Nga

Right now, curses-based apps really don't run well inside Eclipse/PyDev, so, you must really launch it externally. To debug you can use the remote debugger: http://pydev.org/manual_adv_remote_debugger.html
If you use Aptana Studio, there's a terminal view which should emulate a terminal better... try running python (i.e.: running your program) from inside that view. If it does work properly there, maybe I could check a way to better integrate there and launch directly in that view.

Thank you for your reply. I have finally defined kind of a wrapper as a bash script calling python in a xterm. Pydev is checking some configuration by calling eclipse/plugins/org.python.pydev_2.4.0.2012020116/PySrc/interpreterInfo.py so the script first echo the format expected by PyDev. here is the script "
#!/bin/bash
# dummy return for Eclipse Pydev - respect interpreter info format
echo "EXECUTABLE:/home/user/python_custom/python_xterm|
|/home/user/eclipse/plugins/org.python.pydev_2.4.0.2012020116/PySrc
|/usr/lib/python2.5
|/usr/lib/python2.5/plat-linux2
|/usr/lib/python2.5/lib-tk
|/usr/lib/python2.5/lib-dynload
|/usr/local/lib/python2.5/site-packages
|/usr/lib/python2.5/site-packages
|/usr/lib/python2.5/site-packages/Numeric
|/usr/lib/python2.5/site-packages/PIL
|/usr/lib/python2.5/site-packages/gst-0.10
|/var/lib/python-support/python2.5
|/usr/lib/python2.5/site-packages/gtk-2.0
|/var/lib/python-support/python2.5/gtk-2.0
|/var/lib/python-support/python2.5/HTMLgen
|/var/lib/python-support/python2.5/pyinotify
|/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode
|/usr/lib/site-python
#
$
|__builtin__
|__main__
|_ast
|_codecs
|_sre
|_symtable
|_types
|errno
|exceptions
|gc
|imp
|marshal
|posix
|pwd
|signal
|sys
|thread
|xxsubtype
|zipimport
"
# activate scrollbar -sb with 6000 lines
# allow logging -l with filename log_$NOW
xterm -g 150x100+0+0 -sb -sl 6000 -si -hold -e "python $*"
that does the job, and I can use Pydev and its debugger

Related

Passing -X argument for ssh with emacs and tramp

I am using emacs ess and tramp to remotely execute some R script.
I typically have an R script on a server, and I run it interactively on my server, through emacs. This work all well and fine.
However I can not manage to have the plot windows appears from my R script. I would like to obtain from emacs the same behavior that if I ran
ssh -X user#server.com
and then do some R interactively, with plot appearing on my local machine.
I have modified my .ssh/config to add the ForwardX11 yes option, which works for a direct ssh query on my sever but not with emacs/trump
I have also tried the option to customize tramp-default-mode` (see https://superuser.com/questions/609414/emacs-doesnt-use-ssh-config-when-accessing-files-on-a-remote-machine) but this does not work either.
I also came across this very similar question:
How can I launch an x-window from emacs ess when running R on a server?
However:
1) The accepted answer is not a direct answer to the forwardX problem
2) The second answer is not working (am I doing something wrong ? or missing a configuration somewhere?)
Thanks for your help,
edit I use Emacs 23.1.1 on a Ubuntu 16.04
(with-eval-after-load 'tramp
(add-to-list 'tramp-methods
'("sshx11"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
("-e" "none") ("-X") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")
("-o" "ForwardX11=yes")))
(tramp-default-port 22)))
(tramp-set-completion-function "sshx11" tramp-completion-function-alist-ssh))
This is just a copy of the "ssh" method, with the "-X" added to tramp-login-args. Then you can visit a file/directory with C-x C-f /sshx11:user#host:path/to/target.

R system functions always returns error 127

I need to execute an external tool from R and process errors (if any) occurred in that tool.
I know 3 functions to do something familiar with my task:
shell, system and system2.
Trying to test those, I see that command
shell("notepad")
opens notepad. As far as I know shell doesn't allow to check errors (there's no interface to look into stderr).
When I call
system("notepad")
or
system2("notepad")
R freezes trying to make those commands.
Calling
system("start notepad")
or
system2("start notepad")
returns warning
Warning message:
running command '"start notepad"' had status 127
Adapting #DavidTseng's answer (sorry for not having enough reputation to upvote it)...
system("cmd.exe", input = "notepad")
worked for me in Windows.
As I mentioned in my comments, the R documentation reveals that in Windows the system() function does not launch a separate shell (if needed). This is why command line commands run with system(), but Notepad, which needs a separate window, does not run:
From the documentation for system():
The most important difference is that on a Unix-alike system launches a shell which then runs command. On Windows the command is run directly – use shell for an interface which runs command via a shell (by default the Windows shell cmd.exe, which has many differences from a POSIX shell).
system("bash -l", input = "notepad")
I'm not sure if there's been an update to R that allows this since the question was asked nearly four years ago, but system("\"C:\path\to\exe.exe\" args", intern = T) works for me and WILL bring up a separate child window and works on Windows 10 + R 3.6 + RStudio.
Not using the 'intern = T' was giving me a return code of 127 and did not run the process.
I had the same issue. there is an additional step in the installation process which i did not do.
refer to to the url
https://cran.r-project.org/bin/windows/Rtools/
Look for "Putting Rtools on the PATH"
writeLines('PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"', con = "~/.Renviron")
for windows users
wrong: system(path("c:", "program files", "r", "anysoft.EXE"))
but works : system(path("c:", shQuote("program files"), "r", "anysoft.EXE"))
You guys are making it so complicated. I solved this problem by referring to this answer. The problem is with the PATH. type Sys.which('') in R, and you will see nothing. So you have to set the path in CMD, and then use Sys.setenv(PATH = '') in R to get this work.

Installing terminator on cygwin

After going through a lot of sites about best terminal for system admins I was trying to install on Cygwin. Unfortunately, I did not find any good site with instruction about how to do it.
Is anyone done this before? Please help me with steps and packages that I need to install.
Also is there any terminals I can try (like Cygwin)?
I don't know since what version, but now you can install terminator just from the Cygwin installer. And runs great
Regards
If you don't want to use cygwinports, you can actually install all of terminator's dependencies from the cygwin installer, except for terminator itself.
In the cygwin installer select and install:
python-dbus
python-gobject
python-gtk2.0
python-vte (under GNOME tab for some reason)
GConf2
Then, pull down the latest terminator tarball from https://launchpad.net/terminator/+download and extract it somewhere. In a administrator terminal just run python setup.py install and as long as you have a running X server just running terminator will work perfectly.
The sources about how to install terminator are a bit obscures. What I did, and may help you, was this: (although I'm still having segmentation faults errors)
Update your Cygwin to the latest
Open a Cygwin terminal and run: (if you have the x86 version use that. The idea of this step is to use Cygwin Ports)
cygstart -- /your/cygwin/path/setup-x86_64.exe -K http://cygwinports.org/ports.gpg
In the section Choose A Download Site:
Add "http://downloads.sourceforge.net/cygwin-ports"
Add " ftp://ftp.cygwinports.org/pub/cygwinports"
Select another mirror close to you
Check that you have a total of three URLs selected
It may show you warning about not loading the .ini configuration but ignore them (Note: I looked for different port URLs but the official ones threw me errors and I could not pass this step, that's why I used alternatives URLs)
First, you need to install the packages for the X Window:
http://x.cygwin.com/docs/ug/setup.html
Basically they are:
xorg-server (required, the Cygwin/X X Server)
xinit (required, scripts for starting the X server: xinit, startx, startwin (and a shortcut on the Start Menu to run it), startxdmcp.bat )
xorg-docs (optional, man pages)
Also search and select the terminator package
It takes quite a while before it finishes.
Go to Start->All Programs->Cygwin-X->X Win Server (windows tool bar)
A xterm window should open. Type:
terminator
You should know have terminator with Cygwin.
Note: After I run terminator I get this error:
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::sm-connect after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::display after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::default-icon after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
Warning: python-keybinder is not installed. This means the hide_window shortcut will be unavailable
Unable to bind hide_window key, another instance/window has it.
Segmentation fault (core dumped)
I've looking to fix this issue but sadly I couldn't find anything. If you use Cygwin x86 your outcome can be different.
Hope this can help you.

Not able to start Websphere application Server 8.0 in Rational application developer 8

On the console.. I get the following -
Usage: java [-options] class [args...]
(to execute a class)
or java [-jar] [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-? -help print this help message
-X print help on non-standard options
-splash:<imagepath> show splash screen with specified image
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
Eventually the server doesn't start and gets stopped after time-out. The Server was working fine. However, I wanted to restart it. I stopped the server completely and tried starting it. Since then I am facing this issue.
You can check the script that is getting executed when you right click and start the server.
Check if there are any unwanted entries in the java options which does not confirm to the java command line.

xinit Clutter application not working

I've built a simple test app with clutter: A stage with two ClutterText actors to display two words. It works OK when I run it from within gnome but running it from the tty (not gnome-terminal or xterm) with xinit my_app_binary I get an error:
failed to create drawable
Unable to initialize Clutter: Unable to select the newly created GLX context
Window manager error: Unable to initialize Clutter
If I run xinit gnome-terminal from the same tty everything works, gnome-terminal shows up in a black screen. That's the same I want to do with my app.
Is there anything I can do to overcome this error?
All the above are tested in Linux Mint 12. After normal boot I switch to a tty (ALT-F1) and stop lightdm (sudo /etc/init.d/lightdm stop).
Thanks!
EDIT: running as root everything works, so the question is: how to run it as a regular user?
Be sure to set the DISPLAY-var - add it in front of your command
DISPLAY=:0.0 /path/to/myapp
Sometimes this is an access-rights problem - the app should be started with the user who started the X-server
su user-started-x -c 'DISPLAY=:0.0 /path/to/myapp'

Resources