Page 1 of 1

Code editor

Posted: Thu Mar 29, 2018 7:27 pm
by ajocius
Please recommend editor to work with Micropython. I struggle to see where I make mistake, some invisible characters stops all they joy...

Last half an hour I am trying to align code but it throws me errors. As soon as I fix one line (by deleting space at the beginning of line and then tabbing text to the right place), I get error in another line... So I deal with errors like this:
"IndentationError: unexpected indent
MicroPython v1.9.3-318-g60c6b880 on 2018-02-17; ESP32 module with ESP32
"
"IndentationError: unindent does not match any outer indentation level
"

i hope with "right" editor I could possibly see lines with incorrect syntax?

Re: Code editor

Posted: Thu Mar 29, 2018 8:50 pm
by ARTaylor
If you post your code we can probably help you

I use Atom Text Editor with Hydrogen and the Platform IO Terminal Packages - works great for me

EDIT: rshell for your terminal session is pretty useful as well

Re: Code editor

Posted: Fri Mar 30, 2018 12:50 am
by Capstan
I use Microsoft Visual Studio Code (VSCode for short). It is a free download and runs on many platforms. You can install a variety of extensions in it that do all kinds of useful things. One of them is pylint, which identifies many kinds of syntax and indentation errors plus calling methods with the wrong arguments.

Re: Code editor

Posted: Fri Mar 30, 2018 4:25 am
by pythoncoder
@ajocius It would help if you told us what OS you're using. For Linux I recommend Kate.

In Python whitespace matters. Best practice is to configure your editor to convert tabs to spaces (usually four). A mixture of tabs and spaces is a recipe for total confusion where code looks correct but will typically be rejected by the compiler. I suspect this may be your problem.

For communicating with the target I recommend rshell. This is written in Python, runs on Windows/Linux/OSX.

Re: Code editor

Posted: Fri Mar 30, 2018 6:20 am
by stijn
Capstan wrote:
Fri Mar 30, 2018 12:50 am
One of them is pylint
This. Any proper text editor which supports live linting + automatic formatting plugins (pep8/flake8/pylint) will save you a ton of time.

Re: Code editor

Posted: Fri Mar 30, 2018 8:40 am
by ajocius
Thanx, will test it out.

My bad, did not state OS I use. I use Windows 10 x64 (have another pc with W10 x32).

I have Raspberry Pi3 with Raspbian , so I connect with Putty from Windows. Then ESP32 is connected to Rpi3 via usb cable. I run command "rshell --buffer-size=30 -p /dev/ttyUSB0 " to connect to ESP32 and run "repl" there to get feedback from micropython code running on ESP32. I have tested most of code directly in repl, by copying and pasting command lines, so it must be some space/tab issue there. Hopefully listed code editors will help to highlight that. I have been using notepad++ so far.

Re: Code editor

Posted: Fri Mar 30, 2018 8:46 am
by ARTaylor
ajocius wrote:
Fri Mar 30, 2018 8:40 am
Thanx, will test it out.

My bad, did not state OS I use. I use Windows 10 x64 (have another pc with W10 x32).

I have Raspberry Pi3 with Raspbian , so I connect with Putty from Windows. Then ESP32 is connected to Rpi3 via usb cable. I run command "rshell --buffer-size=30 -p /dev/ttyUSB0 " to connect to ESP32 and run "repl" there to get feedback from micropython code running on ESP32. I have tested most of code directly in repl, by copying and pasting command lines, so it must be some space/tab issue there. Hopefully listed code editors will help to highlight that. I have been using notepad++ so far.
I like to use vim for Python (and lots of other stuff) on the Raspberry Pi - but then I am a freak :lol:

Re: Code editor

Posted: Fri Mar 30, 2018 10:31 am
by kevinkk525
I am using Eclipse with pydev plugin for development.
I am using Windows (mainly, at least on my main pc).
To connect to the ESP I made myself some scripts that I run as external tools that sync my files, build the firmware, flash the firmware and connect using rshell/mpfshell. These tools are made for linux which I run in WSL Ubuntu.
My µC are directly connected to my PC.

This worked best for me by now and even using the tools is just a few clicks. of course the micropython specific packages are not included in my development environment but at least the standard python are and I have a folder with all external modules like uasyncio that I include in the pythonpath of my project so I get autocompletion for these as well.

If you know a better way, let me know :D

Re: Code editor

Posted: Wed Apr 11, 2018 7:57 am
by ajocius
I tried Atom code editor, suggested by #ARTaylor . Works great, has various plug ins available, checks syntax, etc. Exactly what i was looking for, thank you!