Programming on Raspberry Pi


#1

Hi. Before I begin, I apologize for my English. 2 months ago I decided to start learning to program in Python. So I bought the book Learn Python 3 the Hard Way from Amazon and the Raspberry Pi computer. They came about 2 weeks ago. I want to remind you that I had no programming experience before and that I am now learning to program on my Raspberry Pi computer. So I opened the book and started reading. I did a few programs without problems, but then other programs did not want to work. So I contacted Zed A. Shaw on the website about his books. He told me that the problem is where I program the python. I use Python 3 (IDLE) and he said it is a bad text editor. Instead, I should use text editors like gEdit, Kate or some other simple editors. And also that it will save some ram on my RPi. And also that I should learn to work with the command line and run python from there.
So I’m asking for advice about which text editor I should download and where, and more tips with installation and command line (that would be great). Because I do not want to play a computer expert and every help would be great.


#2

Hey, so if you are connecting to your RPi computer and using the terminal, then you should try Nano. Just type this:

nano ex10.py

If you want to edit the ex10.py file. It should be installed but bug me and I’ll bust out my RPi machine to try it. Keep in mind that nano is not ideal as a text editor, but it’ll work.

Now if you’re editing the files in a GUI, say with a monitor attached to the RPi, then you can check out gEdit and TEA. Both are nice and small and work well with code.


#3

The RPi is a fantastic device and I have lots of them doing odd things and have used gEdit on them in the past as it is a great little editor.

RPi’s are the primary reason I’m learning Python and so it is my target platform, however it is not where I write my code as I tend to use them headless - that is, without a screen or keyboard, just a network connection and SSH terminal (PuTTY) on another PC.

I’ve been using Visual Studio Code running on Windows 10 which I’ve found to be a really good editor for Python with great syntax highlighting and error & style checking tools. If you have access to a Windows or Mac Laptop or desktop then you might find it easier to write your code there, as I do, and if you’re just learning Python without then need of the RPi’s special hardware features (GPIO etc) then you can also run your code on your Windows / Mac machine.

The code I’m writing specifically does need access to the RPI’s hardware features (GPIO pins) but I still write on Windows and then use the magical SFTP plugin for Visual Studio Code which automatically copies my code from my PC to the RPi every time I hit save. I then flip over to the SSH terminal I have open and run the newly uploaded code on the RPi to test it.

This workflow seems to be working well for me (plus I can test some of the non-RPi specific code on Windows) but if you only have access to your RPi and no other PCs then definitely gEdit is worth trying.


#4

This might be very advanced, but if you install SAMBA on the RPi, then you can mount it from your Windows 10 machine and just edit the files right there. Just like how you mount drives on remote machines with SMB on Windows.


#5

I think IDLE is the best tool for you. It’s include in the raspberry OS.


#6

I have a raspberry pi and the text editor on it fine;

Raspberry pi start (top left hand corner)
Accessories
Go down to “Text Editor”

Just don’t use the Python 2 or 3 IDE.

Nano is also very practical.

Cheers tc


#7

Thought I better add, raspberry pi will run out of memory on large files. You can over come this by using a powered hard drive as a swap drive. Please note this may not be an issue for most things done in “learn python the hard way”.

My recommendation, if you can afford it is buy a cheap laptop (max $200) most I will spend and install “Linux Mint”.

If you have any troubles with understanding the specifications of the laptop then message tcratius@gmail.com or put it on the learn code the hard way website.

Happy coding :slight_smile:


#8

Clever way to do it. Will try that as VNC view is slow. Cheers