New error is shown when attempting to program the platform with a terminal application already connected: "[mbed] ERROR: Unknown Error: __init__() should return None, not 'bool'"
Mbed CLI 1.7.2
Steps to reproduce:
mbed import mbed-os-example-blinky
cd mbed-os-example-blinky
mbed compile -t GCC_ARM -m K64F -f
...
Total Static RAM memory (data + bss): 12352 bytes
Total Flash memory (text + data): 51513 bytes
Image: ./BUILD/K64F/GCC_ARM/mbed-os-example-blinky.bin
[mbed] Detected "K64F" connected to "/Volumes/DAPLINK" and using com port "/dev/tty.usbmodem1412"
[mbed] ERROR: Unknown Error: __init__() should return None, not 'bool'
@MarceloSalazar Yep bug.
ARM Internal Ref: MBOTRIAGE-440
@theotherjimmy Could you provide more information where this bug is coming from? I'm unable to reproduce it.
Sure. Just a sec.
here: https://github.com/ARMmbed/mbed-cli/blob/master/mbed/mbed_terminal.py#L38
and: https://github.com/ARMmbed/mbed-cli/blob/master/mbed/mbed_terminal.py#L46
Both should not return anything. As the error message says, constructors return None.
I'm having this same issue, is there currently any work arounds?
edit: Looks like I did something to fix it for myself? Not sure what I changed in my VM, but Im guessing the error is only thrown if there is an underlying problem with your system?
Afaik this is not a fatal error.
In my environment, only happens when a serial terminal is open and I attempt to program the device (mbed compile ... -f)
using xenial in chroot on Chromebook
mbed version 1.7.5
mbed sterm
[mbed] Detecting connected targets/boards to your system...
[mbed] Opening serial terminal to "DISCO_L072CZ_LRWAN1"
[mbed] ERROR: Unknown Error: __init__() should return None, not 'bool'
@NiallBegley, @nicbkw, and @MarceloSalazar, the workaround for me was to update pyserial.
My system already had pyserial-2.7 and pip install --upgrade pyserial resulted in pyserial-3.4
Added traceback.print_exc to identify failing calls to self.serial.reset_input_buffer(), etc.
To me it looks like there are two bugs here:
1) switch to MbedTerminal class in #664 looks like it kept some error handling from the older mbed_cdc subroutine, including returning boolean error flag instead of None.
2) installer may not properly identify dependency on pyserial > 3.0 (or even higher)
2a) might be possible to detect version via serial.VERSION and adapt calls accordingly. Or just use the older calls (e.g., flushInput() instead of reset_input_buffer()). At least with pyserial-3.4, it looks like the old calls have been retained.
@screamerbg , what do you think?
Note I already had python installed on my machine via python(x,y) superpackage, and didn't want to break it by installing another python environment. So it's possible that the bug doesn't show up when the default mbed-cli installer options are used...
...updated but still problem - now
using xenial in chroot on Chromebook
mbed version 1.8.0
pyserial 3.4
mbed sterm
[mbed] Detecting connected targets/boards to your system...
[mbed] Opening serial terminal to "DISCO_L072CZ_LRWAN1"
[mbed] ERROR: Unknown Error: init() should return None, not 'bool'
I'm still getting this error when I run 'mbed sterm' or 'mbed compile -f' Ubuntu 18.04:
jojo@ubuntu:~/projects/mbed-blinky/mbed-blinky$ mbed sterm
[mbed] Detecting connected targets/boards to your system...
[mbed] Opening serial terminal to "DISCO_F469NI"
[mbed] ERROR: Unknown Error: __init__() should return None, not 'bool'
---
jojo@ubuntu:~/projects/mbed-blinky/mbed-blinky$ mbed --version
1.8.2
mbed-os is >= 5.10.1.
On Windows 10, it is working and I get no error.
Update:
I've changed back the return value to None and I've printed the exception message, its a permission issue:
except Exception as e:
print(e)
self.serial = None
return None
jojo@ubuntu:~/projects/mbed-blinky/mbed-blinky$ mbed sterm
[mbed] Detecting connected targets/boards to your system...
[mbed] Opening serial terminal to "DISCO_F469NI"
[Errno 13] could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'
But it looks like the return value of a python constructor is handled different under windows/linux. Anyway, returning something from a constructor is not allowed in python,
https://stackoverflow.com/questions/2491819/how-to-return-a-value-from-init-in-python
So the linux runtime error looks correct.
Could be as simple as not having the right permissions to use the serial port, e.g. sudo chmod 666 /dev/ttyACM0
Get Outlook for Androidhttps://aka.ms/ghei36
From: JojoS notifications@github.com
Sent: Wednesday, October 17, 2018 1:58:02 PM
To: ARMmbed/mbed-cli
Cc: Nic Burkinshaw; Mention
Subject: Re: [ARMmbed/mbed-cli] [mbed] ERROR: Unknown Error: __init__() should return None, not 'bool' (#688)
I'm still getting this error when I run 'mbed sterm' or 'mbed compile -f' Ubuntu 18.04:
jojo@ubuntu:~/projects/mbed-blinky/mbed-blinky$ mbed sterm
[mbed] Detecting connected targets/boards to your system...
[mbed] Opening serial terminal to "DISCO_F469NI"
jojo@ubuntu:~/projects/mbed-blinky/mbed-blinky$ mbed --version
1.8.2
mbed-os is >= 5.10.1.
On Windows 10, it is working and I get no error.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/ARMmbed/mbed-cli/issues/688#issuecomment-430617507, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEdjdOnYC7e27k1--dKrW2ZrgCnpFECsks5ulylagaJpZM4UZH95.
yes, so printing the exception points directly to the problem. Another reason for failure would be an already opened port, this is also caught by the exception and printed as error message.
I see, the return problem is fixed in #765 already but not released yet.
How about printing the exception reason?