Call command history when script is Run with pdb in PyCharm - console

When I use Run in PyCharm 3.4 (Windows 8.1) for this script:
if __name__ == "__main__":
x = 'lolo'
import pdb; pdb.set_trace()
print(x)
I navigate to Run Tool Window where I can play with pdb:
C:\Python27\python.exe D:/check/old/stack.py
> d:\check\old\stack.py(4)<module>()
-> print(x)
(Pdb) x
'lolo'
(Pdb)
But I cannot figure out how to call last command / navigate through history of commands.
↑, or with ctrl, alt, shift gives nothing :(
In build in PyCharm Terminal or in Windows Command Prompt / Git Bash it works as expected.
Maybe there is some configuration of Run what I'm missing?

They state that this has already been implemented as CTRL + ALT + E (configurable via Settings > Keymaps > Other > Browse History (see http://youtrack.jetbrains.com/issue/PY-7622) or as CTRL + ↑ (see http://youtrack.jetbrains.com/issue/PY-1199).
However, both didn't work for me either.

Related

how to troubleshoot Radian as VS Code Terminal for R

radian (for R) is not starting as terminal in VS Code
There is an extended error message (from python exception?) that is displayed briefly, then the terminal closes and error message comes up:
The terminal process
"c:\Program Files\Python310\Scripts\radian.exe '--nosave', '--no-restore', '--r-binary="C:/program files/R/R-4.1.3/bin/x64/R.exe"'"
terminated with code: 1.
If I cut-n-paste the command line into a VS Code terminal - then radian starts perfectly fine. (Works in both a command prompt terminal or a git bash terminal.)
How do I stop the terminal closing on error, so that the python exception log can be read ?
Is the problem known ? (I suspect its related to VS Code Environment.)
Note: I have terminal.integrated.inheritEnv: true
Looking at the settings that you have above - is it that your r-binary option flag is set using forward slashes in your path instead of backslashes? i.e. the flag should be:
--r-binary="C:\program files\R\R-4.1.3\bin\x64\R.exe"
instead of what you have right now, which is:
--r-binary="C:/program files/R/R-4.1.3/bin/x64/R.exe"

Running Nvim-R via PuTTy: setting up r_term_cdm

I would like to run Nvim-R on a remote machine via putty when I try to open a *.R file the remote machine returns an error message:
Please set the variable g:R_term_cmd in your vimrc. Read the plugin
documentation ...
According to the documentation, the R_term_cmd should be used in the following manner:
If |R_in_buffer| = 0 and the X Window System is running and tmux is
installed, then R will run in an external terminal emulator. The
plugin uses the first terminal emulator that it finds in the following
list:
1. gnome-terminal,
2. konsole,
3. xfce4-terminal,
4. Eterm,
5. (u)rxvt,
6. aterm,
7. roxterm,
8. terminator,
9. lxterminal
10. xterm.
If Vim does not select your favorite terminal emulator, you may define
it in your vimrc by setting the variable R_term, as shown below:
let R_term = "xterm"
If your terminal emulator is not listed above, or if you are not satisfied with the way your terminal emulator
is called by the plugin, you may define in your vimrc the variable
R_term_cmd, as in the examples below:
let R_term_cmd = "xterm -title R -e"
let R_term_cmd = "xfce4-terminal --icon=/path/to/icons/R.png --title=R -x"
However, this variable does not appear to be utilised by the sample configuration files available through the Vim-R-Tmux: An Integrated Working Environment for R. Furthermore, the settings in vimrc:
" start R with F2 key
map <F2> <Plug>RStart
imap <F2> <Plug>RStart
vmap <F2> <Plug>RStart
" send selection to R with space bar
vmap <Space> <Plug>RDSendSelection
" send line to R with space bar
nmap <Space> <Plug>RDSendLine
<LocalLeader> settings
The suggested <LocalLeader> settings not appear to work as pressing F2 does not launch connected R session.
Software versions
tmux 2.3
VIM - Vi IMproved 8.0
You have two options
Use Tmux, which you apparently are
This way, Nvim-R can actually use a tmux pane to start an R console.
Please refer to section 9.21 Integration with Tmux in the documentation.
You need to put the following in your vimrc:
let R_in_buffer = 0
let R_applescript = 0
let R_tmux_split = 1
Or just use NeoVim
NeoVim has a builtin terminal, which actually just works with the Nvim-R plugin.

How to stop a command in R in Windows

I'm using Rstudio in Windows. There is no red octagon for me to click on. I've tried pressing ESC and Ctrl + C and Ctrl + Z in the console but none of those worked.
When running a code, the red octagon will only show while it is working things out. So while it is just running through your written code (reading data and names of things etc) then the octagon will not show.
Pressing ESC will work, unless Rstudio is frozen.
Good luck!
You could also try interrupting/terminating the R session via the menu:
Session -> Interrupt R
or
Session -> Terminate R...
or
Session -> Restart R (Ctrl+Shift+F10)
If nothing else helps, open the Windows command line and kill the rsession.exe proces:
> tasklist | grep rsession
# the output should be something like this:
rsession.exe 7260 Console 1 166,144 K
# The number (7260 in this case; will probably be different) is the process id (PID),
# and you can use it to kill the process:
> taskkill /F /PID 7260
Caution: this will forcefully stop the R session, and RStudio will probably have to restart (this is what happens on my machine, at least).
Using ctrl + alt + delete opens task manager and you can terminate the R session then restart it to continue working.

knitr won't run Python commands

I have used knitr for a long time, usually in the R Studio environment. Recently I installed Python (version 3.4.1) on my Windows machine, put it in the path, and tried out Yi Hui Xie's sample document for Python. But the Python code chunks won't run. From a chunk like this:
{r test-python, engine='python'}
x = 'hello, python world!'
print x
print x.split(' ')
I get an error message like this:
Warning: running command '"python" -c "print '**Write** _something_ in `Markdown` from `Python`!'"' had status 1
running: "python" -c "x = 'hello, python world!'
print x
print x.split(' ')"
File "<string>", line 2
print x
^
SyntaxError: invalid syntax
I'm in Windows 7, running R 3.1.0, with RStudio Version 0.98.847 (beta preview version). Interactive Python opens just fine from the command line.
Any ideas?
Your issue is that you've installed python3, but the syntax you're using is python2. The py2 -> py3 transition involved changes to the language itself -- in your example, print has changed from a syntax to a function. (So print(x) would work in your code above.)
The easiest option is to uninstall python3 and install the most recent Python 2.7 (currently Python 2.7.6). Alternately, onward and upward -- use py3, which just involves possibly tweaking any existing examples you run into in knitr.

command prompt, opening a csv file?

how do i open a file csv ? with the last command here vi
it open it the command prompt, but how do i open it on csv file normarlly
without open it on the command prompt?
[#dc1-ora rci]$ ls
backup diamond20130306.csv
diamond2012_04_30_dev.csv diamond_points_20120820.csv
diamond20120801.csv diamond_points_20120827.csv
diamond20120802.csv diamond_points_20120828.csv
diamond20120803.csv diamond_points_20121217.csv
diamond20120804.csv diamond_points_20130129.csv
diamond20120806.csv diamond_points_20130130.csv
diamond20120807.csv diamond_points_20130205.csv
diamond20120808.csv diamond_points_20130306.csv
diamond20120828.csv diamond_points_20130326.csv
diamond20120906.csv diamond_points_20130410.csv
diamond20121025.csv diamond_rental_20121219.csv
diamond20121029.csv diamond_rental_20121220.csv
diamond20121218.csv diamond_rental_20121221.csv
diamond20130128.csv ilx_final_lead_merge.csv
diamond20130129.csv test_diamond20120820.csv
diamond20130130.csv test_diamond20120827.csv
diamond20130131.csv test_diamond20120828.csv
diamond20130205.csv test.txt
diamond20130219.csv THH_RCT_RCI_EDM_FILE_01_28_13.csv
[#dc1-ora rci]$ vi test_diamond20120820.c
sv
( opens file here on the command prompt)
On windows/cmd you should do:
start notepad++ test_diamond20120820.csv
in your case:
start Excel.exe test_diamond20120820.csv
or for the default application associated with it use :
start test_diamond20120820.csv
(didn't test I am using linux maybe I will test it later if I reboot)
But I suspect you don't mean command prompt but a linux terminal (because of your tags):
you can use any of those:
gedit test_diamond20120820.csv &
nedit test_diamond20120820.csv &
etc depending on the programs you have installed
or for the default application associated with it use :
xdg-open test_diamond20120820.csv
if you are remotely logged in using ssh make sure you have X enabled

Resources