OmuBobo
Posts: 7
Joined: Sun Aug 31, 2014 7:35 pm

How are you writing your more complex code ?

Tue Sep 02, 2014 10:45 pm

Hy,

I just want to know what you guys use to write your GPIO pytho scripts ? IDE? code on another machine then just transfer to raspberry, or code in nano text editor ?
I'm writing my small programs, GPIO scripts with the help of nano at the moment. But would be great to use a IDE on a faster machine, and debug and run on the raspberry without needing to copy files, libraries etc.

Thanks!

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 2:33 am

Pressing the git/rsync,run-tests button is the same number of clicks as pressing the run-tests button.
Alternately there is network file systems (sshfs,smb,nfs,etc) if you want to edit remote files in place.

vim
eclipse
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

WebPi
Posts: 262
Joined: Wed Apr 10, 2013 6:47 pm
Location: Birmingham, UK
Contact: Website

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 9:10 am

I have a monitor, mouse and keyboard attached to my Pi so that I can use it like a desktop PC, and edit code in Leafpad. It's a pretty basic way of writing code, but it works for me. I've written a Python CMS this way - it's grown to about 4000 lines of code.

I've used a wide variety of development tools in the past, and they're ok, but I find I can get just as much done with a simple text editor. Some tools are so big and complex they get in the way of writing code (Eclipse is a good example of this).

I'm doing most of my debugging by printing messages to stdout. Sometimes I miss having access to a decent debugger, but I don't think it's a massive problem.
raspberrywebserver.com - Raspberry Pi tutorials
LinuxWebServers.net - Linux Web Server tutorials and examples
pyplate.com - Python web publishing tool

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 10:10 am

I tend to write my code on my laptop using SublimeText 3. If the code involves GPIO, and it's not fundamental to the code I'm testing, then I will include a fake GPIO module so that the GPIO lines don't throw errors. Alternatively, I use samba on the pi and mount the folder so I can then edit code on the laptop but run on the Pi via ssh.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
DougieLawson
Posts: 37701
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 10:16 am

Who needs an IDE? Just start two PuTTY sessions. One for running the code, one for editing it with vi (aka vim).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 11:27 am

I install X11VNC and Samba on my Pi.

I edit my Python code (using notepad++) across the network on my PC/Laptop and then test it using LXTerminal on the Pi

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

TrevorAppleton
Posts: 74
Joined: Wed May 30, 2012 7:26 pm
Contact: Website

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 12:25 pm

I have a blog post which explains how you can remotely modify code on your Raspberry Pi. I did some research on this subject after having the same thought as you!

http://trevorappleton.blogspot.co.uk/20 ... -your.html
Check out my blog post for Raspberry Pi and Python tutorials.

http://trevorappleton.blogspot.co.uk/

OmuBobo
Posts: 7
Joined: Sun Aug 31, 2014 7:35 pm

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 8:50 pm

Thanks for all the suggestions guys, some good tips !! TrevorAppleton the guide on your blog is very good. I think you gave me the solution i was looking for. I've installed TextWrangler, configured it for remote access to the pi and opened a ssh in witch i will test my program !

riklaunim
Posts: 265
Joined: Tue Apr 22, 2014 7:34 pm

Re: How are you writing your more complex code ?

Wed Sep 03, 2014 11:58 pm

SFTP/SSH is a quick way to copy and execute code from workstation PC to RPi. I've also experimented with SSHFS where the workstation had a folder from Raspbian on Pi mounted and the PyCharm IDE was editing code there and using remote Raspbian Python environment to execute it on Pi from within Pycharm interface (no copy/paste etc.).

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How are you writing your more complex code ?

Thu Sep 04, 2014 7:00 am

@trevor
Excellent find (Notepad++ using NPPFtp) :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

TrevorAppleton
Posts: 74
Joined: Wed May 30, 2012 7:26 pm
Contact: Website

Re: How are you writing your more complex code ?

Thu Sep 04, 2014 3:59 pm

Glad you like the blog post!
Check out my blog post for Raspberry Pi and Python tutorials.

http://trevorappleton.blogspot.co.uk/

OmuBobo
Posts: 7
Joined: Sun Aug 31, 2014 7:35 pm

Re: How are you writing your more complex code ?

Thu Sep 04, 2014 6:02 pm

riklaunim wrote:SFTP/SSH is a quick way to copy and execute code from workstation PC to RPi. I've also experimented with SSHFS where the workstation had a folder from Raspbian on Pi mounted and the PyCharm IDE was editing code there and using remote Raspbian Python environment to execute it on Pi from within Pycharm interface (no copy/paste etc.).
I have tried that as well, just i can't manage to get write permission to mounted folder on the workstation, any suggestions ? I am on Mac. Thanks

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: How are you writing your more complex code ?

Mon Sep 08, 2014 9:57 am

DougieLawson wrote:Who needs an IDE? Just start two PuTTY sessions. One for running the code, one for editing it with vi (aka vim).
i've been using notepad++ with ftp plugin from the beginning of time (with a putty session to test), but i'd really really like to see dougie using vi or vim :)
i already hate nano when i have to use it, but vi.. lol..

User avatar
joan
Posts: 14759
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How are you writing your more complex code ?

Mon Sep 08, 2014 10:04 am

On the laptop I'll generally use gedit. I use vim on the Pi. I use vim on the laptop when it is quicker than gedit (vim has better support for macros and regular expressions).

User avatar
PeterO
Posts: 5623
Joined: Sun Jul 22, 2012 4:14 pm

Re: How are you writing your more complex code ?

Mon Sep 08, 2014 10:25 am

My PIs mount /opt/RPI/from my desktop Linux machine. I edit source with emacs on the desktop and build locally on the PIs.

The PIs I use for development all have 500Gb USB external disks with the root file system on them. SDcard is only used for /boot patition for booting.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

harvy
Posts: 93
Joined: Mon Nov 26, 2012 1:49 pm
Location: London - UK

Re: How are you writing your more complex code ?

Tue Sep 09, 2014 10:25 am

Im using mobaxterm

http://mobaxterm.mobatek.net/

Got SFTP, and a text editor built in, along with ssh.

So i make an ssh connection,
on the browser side i open the file in the editor, make changes, save (but dont close)
On the command line i run the code.
Make changes in the editor, save
rerun etc..

Return to “Python”