-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
“SyntaxError: invalid syntax” always show on mu-editor at REPL mode with micro:bit #576
Comments
@carlosperate would you know whether MicroPython on the micro:bit allows for this form? (I don't have a m:b nearby to check for myself) |
Thank you, Dear @tjguk and @ZanderBrown :) I have made some progress on this issue. However, I still have not solved this problem completely. @ZanderBrown said: "Can only assume there is some invisible char or something". This makes me wonder if it is possible to relate to my input method, input device, or language(locale). Since I am a Taiwanese, we use Traditional Chinese (unlike Simplified Chinese used in mainland China). In /etc/default/locale, my original settings are as follows:
Then, I change the content to be as follow first:
Second, I tried to change my Region & Language to be English and United States. Third, I set my keyboard input method system to be none Finally, I reboot my system. We can see an interesting result: If I try to use keyboard to input directly, it will not repeat the characters, or not respond. Besides, I can use minicom mode to use REPL, but it still repeat chars.... |
I'm not sure what's happening there. I haven't been involved with the remote REPL part of Mu to date, so I don't know what stack of serial-bytes-encoding it's using. Might have to wait until @ntoll can have a look, as he put all that together. In any case, thanks for doing the legwork to try to narrow things down @seiferthan. Please let us know if you get any more clues, and I hope that someone else on the team might be able to get some insight from what you've shown us. |
As @seiferthan still has issues when using minicom (thus skipping Mu completely) this could be a MicroPython (@dpgeorge?) or even a Ubuntu issue. I don't know if you have different computer or micro:bits to play with but it could be interesting to see what different combinations do. |
can you confirm that you actually tried the latest version, and the banner at the REPL was actually:
Your window title of Mu it says "Mu 1.0.0" so I assume you got v1.0.0-rc.2 of the MicroPython micro:bit firmware? |
Thank you @seiferthan for the detail report and steps to solve it. The micro:bit doesn't have hardware flow control pins wired, so enabling the Hardware flow control feature in the application shouldn't make that much of a difference. However, your first point about changing the locale and then rebooting (to make sure the locale is applied correctly) does look to be the main issue. As Damien has also mentioned (thanks Damien!), that REPL start string looks like an older version of MicroPython than the one included in Mu v1.0.0. @seiferthan Could you try creating a new empty script and flashing that? By doing so Mu should detect it and flash the latest interpreter, and then when the REPL is opened it should print the string Damien showed:
If that doesn't happen, is it possible you have included an alternative runtime in the Mu settings? |
Epic debugging here. Thank you, glad it's been solved. |
@ntoll, I would argue this hasn't been solved. It shoudn't be a requirement for Mu to change the operating system locate for the REPL to work. @seiferthan With your original locale, were you able to use the Python3 REPL without issues? |
@carlosperate I'm not sure I follow. Mu has no control over what the user has set, right..? Since we can't do any more, but point users who have the same problem, to this GitHub issue, then what more can we do (except close it)..? |
Yes, Mu doesn't have any control on the user-set OS language and encoding, but if there is an issue with unexpected encodings that stops the user from using the REPL, then perhaps there is something Mu can do to detect this and do any conversion required. The repeating characters in the REPL could be an issue with MicroPython, there was an issue in this area already fixed a little while ago, which is also why we'd like to know if the user is using the RC2 version in their micro:bit (based on the REPL opening string it looks like an older version than that shipped with Mu v1.0.0). However, the fact that writing the text on an editor, then copying it and pasting it into the REPL and getting the right result would suggest that there could be a problem on how Mu is serialising the user input. |
@carlosperate but cut and paste into the REPL is exactly the same as typing the commands in with a keyboard. My guess is if you're pasting I'm not sure how Mu is supposed to detect such a problem? The best, easiest and simplest thing for us to do is log this somewhere in the documentation so it's easy for people to discover. If you're asking for Mu to detect invisible characters, then you're likely advanced enough to know how to follow the instructions kindly provided above. If we try to solve this problem in code then we're adding complexity. That ain't gonna happen, ergo this issue should be closed. ;-) |
Dear creator:
I use mu-editor 1.0.0 on Ubuntu 18.04. When I try to do a very simple calculation such as "2+2"(without ""), the REPL mode always show the error message as follow:
on v1.9.2-34-gd64154c73 on 2017-09-01; micro:bit v1.0.0-rc.2 with
nRF51822
Type "help()" for more information.
the detail is written on stackoverflow:
https://stackoverflow.com/questions/51509698/syntaxerror-invalid-syntax-always-show-on-mu-editor-at-repl-mode-with-microb
I try to find out answer on internet, but I still can't figure out how and why. Please help me try to handle this problem.
Thank you so much anyway.
The text was updated successfully, but these errors were encountered: