Forums

Stepping Through Code

I'm an R programmer who uses RStudio and have used PyScripter a bit in the past to script some Python...

PythonAnywhere seems great but I'm wondering, is there a way to highlight and run single lines and sections of code in the file editor and see the results of just that code in the console?

This is really useful for fast debugging and is my bread and butter in R.

Thanks.

We don't have it for the editor, but Python has a very useful debugger called pdb. It can be a little difficult to learn to use, but if you're looking for a debugger, that's the one to use.

Okay thanks... can we consider this a feature request then?

This would be a big selling point I think.

Interesting. How does it work in R/RStudio? In Python, if you wanted to select and run an arbitrary piece of code, and you just did it naively, you'd get a bunch of "not defined" errors... So if you wanted to get it to work, you'd have to do some sort of static code analysis to see what the dependencies of that block of code were, and get all the imports done, and so on...

If you're doing stats + scientific computing, most people seem to gravitate towards IPython as their console of choice -- you should check that out. IPython notebook is also very powerful, but sadly we don't support that (yet)...

@thedon16 I haven't got time to go look at R, sadly, but any chance of pasting a couple of R snippets here for the Python folk to think about?

Jim

Did y'all know we have a version of R installed on servers btw?

@Jim and Harry

Actually I think Spyder and Pyscripter IDEs have this feature for Python. You can either run the whole file or just one line or a highlighted portion. If all the prior imports and variables are loaded it's a very convenient way to see the effects of changes or find bugs. The fastest way I think. I do a lot of modelling and data analysis and this comes up a lot.

RStudio offers a server based version of their IDE and in their FAQ they say they are planning on offering a hosted version of it in the future. http://www.rstudio.com/ide/docs/server/getting_started I don't know of anything hosted as of now.

Hi

I love pythonanywhere, but this is a feature that I do miss. Copying and pasting from to the console sometimes works, but it's tricky with the indents. But this feature would be awesome