mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.42k stars 437 forks source link

ESP-mode REPL: Off by one in error-message line numbers. #839

Closed dybber closed 4 years ago

dybber commented 5 years ago

Error messages reported when executing a file using the "Run" button in ESP-mode, are reported on line N+1, when error is on line N.

E.g. with an error on line 14, the following error is reported:


  File "<stdin>", line 15, in <module>```
dybber commented 5 years ago

@ntoll: Do you remember why this newline was added: https://github.com/mu-editor/mu/blob/master/mu/interface/panes.py#L309

ntoll commented 5 years ago

No (I don't remember). I believe it may be an un-wanted part of the "recipe" for putting the device into raw mode, copied from the microfs command. I'm up to my eyes in creating a new web mode for Mu, but once that's ready to be a PR I can tackle the "low hanging fruit" bugs in preparation for the alpha.2 release.

dybber commented 5 years ago

Okay, I think we should use one of the existing implementations for entering/exiting raw REPL (e.g. call the one in microfs.py), they include very specific timings and checks that all the right phases have passed, and I don't believe a newline here is necessary. I can look at it one of the next days.

dybber commented 5 years ago

Okay, the code in microfs is harder to reuse than I anticipated as microfs uses pyserial, and Mu uses QSerialPort which are incompatible.

dybber commented 5 years ago

I can see the reason for using QSerialPort to use Qt signals on incoming messages. Should I try porting the enter/exit raw REPL code from microfs.py or pyboard.py to use QSerialPort?

carlosperate commented 4 years ago

@dybber did #839 fix this issue?

dybber commented 4 years ago

Yes, this was fixed by #1017