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?
Code editor
Re: Code editor
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
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
Grow something!
Re: Code editor
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.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Code editor
@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.
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.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Code editor
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.
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
I like to use vim for Python (and lots of other stuff) on the Raspberry Pi - but then I am a freakajocius wrote: ↑Fri Mar 30, 2018 8:40 amThanx, 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.
Grow something!
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: Code editor
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
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
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Re: Code editor
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!