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.4k stars 434 forks source link

flashing a microbit fails #2340

Open rhubarbdog opened 2 years ago

rhubarbdog commented 2 years ago

What were you trying to do?

flash a new, but saved program

What steps did you take to trigger the issue?

loaded mu withe the following command

mu-editor interupts_display.py

typed in a program saved it clicked flash it crashed with the following message

qt5ct: using qt5ct plugin
qt5ct: custom style sheet is disabled
Traceback (most recent call last):
  File "/usr/share/mu-editor/mu/modes/microbit.py", line 254, in flash
    if uflash.get_minifier():
AttributeError: module 'uflash' has no attribute 'get_minifier'
QXcbClipboard: Unable to receive an event from the clipboard manager in a reasonable time

What did you expect to happen?

the micro bit to flash

What actually happened?

mu crashed and the widow closed and disappeared withe the above output to my terminal window

Operating System Version

linux mint 20.2

Mu Version

1.0.2

Other Info

No response

Editor Log

2022-09-28 13:42:23,235 - root:112(run) INFO:


Starting Mu 1.0.2 2022-09-28 13:42:23,235 - root:113(run) INFO: uname_result(system='Linux', node='asus-02', release='5.4.0-113-generic', version='#127-Ubuntu SMP Wed May 18 14:30:56 UTC 2022', machine='x86_64', processor='x86_64') 2022-09-28 13:42:23,235 - root:114(run) INFO: Python path: ['/usr/share/mu-editor', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions'] 2022-09-28 13:42:23,235 - root:115(run) INFO: Language code: en_GB 2022-09-28 13:42:23,326 - mu.logic:543(init) INFO: Setting up editor. 2022-09-28 13:42:23,326 - mu.logic:562(init) INFO: Settings path: /home/phil/.local/share/mu/settings.json 2022-09-28 13:42:23,326 - mu.logic:563(init) INFO: Session path: /home/phil/.local/share/mu/session.json 2022-09-28 13:42:23,326 - mu.logic:564(init) INFO: Log directory: /home/phil/.cache/mu/log 2022-09-28 13:42:23,326 - mu.logic:565(init) INFO: Data directory: /home/phil/.local/share/mu 2022-09-28 13:42:23,333 - mu.logic:578(setup) INFO: Available modes: python, adafruit, microbit, debugger, pygamezero 2022-09-28 13:42:23,416 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/phil/mu_code 2022-09-28 13:42:23,416 - mu.logic:625(restore_session) INFO: Restoring session from: /home/phil/.local/share/mu/session.json 2022-09-28 13:42:23,416 - mu.logic:626(restore_session) DEBUG: {'theme': 'day', 'mode': 'microbit', 'paths': ['/home/phil/mu_code/rats.com.py'], 'envars': [], 'minify': False, 'microbit_runtime': '', 'zoom_level': 2} 2022-09-28 13:42:23,416 - mu.logic:713(_load) INFO: Loading script from: /home/phil/mu_code/rats.com.py 2022-09-28 13:42:23,416 - mu.logic:274(read_and_decode) DEBUG: Trying to decode with utf-8 2022-09-28 13:42:23,416 - mu.logic:277(read_and_decode) INFO: Decoded with utf-8 2022-09-28 13:42:23,417 - mu.logic:290(read_and_decode) DEBUG: Detected newline '\n' 2022-09-28 13:42:23,417 - mu.logic:787(_load) DEBUG: # Write your code here :-)

RATS.com

from microbit import *

freq = 60

while true: if button_a.is_pressed(): freq = freq - 10 if button_b.is_pressed(): freq =freq + 10 if freq < 0: freq = 0 if freq > 100000: freq =100000 sleep(10)

2022-09-28 13:42:23,444 - mu.logic:647(restore_session) INFO: Loaded files. 2022-09-28 13:42:23,444 - mu.logic:650(restore_session) INFO: User defined environment variables: [] 2022-09-28 13:42:23,445 - mu.logic:654(restore_session) INFO: Minify scripts on micro:bit? False 2022-09-28 13:42:23,445 - mu.logic:843(load_cli) INFO: Passed-in filename: interupt_display.py 2022-09-28 13:42:23,445 - mu.logic:713(_load) INFO: Loading script from: /home/phil/mu_code/interupt_display.py 2022-09-28 13:42:23,445 - mu.logic:274(read_and_decode) DEBUG: Trying to decode with utf-8 2022-09-28 13:42:23,445 - mu.logic:277(read_and_decode) INFO: Decoded with utf-8 2022-09-28 13:42:23,445 - mu.logic:290(read_and_decode) DEBUG: Detected newline '\n' 2022-09-28 13:42:23,445 - mu.logic:787(_load) DEBUG: from microbit import *

@micropython.asm_thumb def block_irq(): cpsid('i') # disable interrupts to go really fast

@micropython.asm_thumb def unblock_irq(): cpsie('i') # enable interupts nolonger time critical

block_irq()

read sensor

sleep(1000) unblock_irq() display.scroll('Microbit')

2022-09-28 13:42:23,469 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/phil/mu_code 2022-09-28 13:47:12,624 - mu.logic:700(new) INFO: Added a new tab. 2022-09-28 13:59:04,491 - mu.logic:809(get_dialog_directory) INFO: Using path for file dialog: /home/phil/mu_code 2022-09-28 13:59:27,807 - mu.interface.main:263(get_save_path) DEBUG: Getting save path: /home/phil/mu_code/interupts4.py 2022-09-28 13:59:27,808 - mu.logic:903(check_for_shadow_module) INFO: Checking path "/home/phil/mu_code/interupts4.py" for shadow module. 2022-09-28 13:59:27,808 - mu.logic:869(save_tab_to_file) INFO: Saving script to: /home/phil/mu_code/interupts4.py 2022-09-28 13:59:27,808 - mu.logic:870(save_tab_to_file) DEBUG: from microbit import * import machine

state=machine.disable_irq() sleep(1000) machine.enable_irq(state) display.scroll('Microbit') 2022-09-28 13:59:36,716 - mu.modes.microbit:240(flash) INFO: Preparing to flash script. 2022-09-28 13:59:36,716 - mu.modes.microbit:250(flash) DEBUG: Python script: 2022-09-28 13:59:36,716 - mu.modes.microbit:251(flash) DEBUG: b"from microbit import *\nimport machine\n\nstate=machine.disable_irq()\nsleep(1000)\nmachine.enable_irq(state)\ndisplay.scroll('Microbit')" 2022-09-28 13:59:36,716 - root:95(excepthook) ERROR: Unrecoverable error Traceback (most recent call last): File "/usr/share/mu-editor/mu/modes/microbit.py", line 254, in flash if uflash.get_minifier(): AttributeError: module 'uflash' has no attribute 'get_minifier' 2022-09-28 14:14:28,009 - root:112(run) INFO:


Starting Mu 1.0.2 2022-09-28 14:14:28,009 - root:113(run) INFO: uname_result(system='Linux', node='asus-02', release='5.4.0-113-generic', version='#127-Ubuntu SMP Wed May 18 14:30:56 UTC 2022', machine='x86_64', processor='x86_64') 2022-09-28 14:14:28,009 - root:114(run) INFO: Python path: ['/usr/share/mu-editor', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions'] 2022-09-28 14:14:28,009 - root:115(run) INFO: Language code: en_GB 2022-09-28 14:14:28,057 - mu.logic:543(init) INFO: Setting up editor. 2022-09-28 14:14:28,057 - mu.logic:562(init) INFO: Settings path: /home/phil/.local/share/mu/settings.json 2022-09-28 14:14:28,057 - mu.logic:563(init) INFO: Session path: /home/phil/.local/share/mu/session.json 2022-09-28 14:14:28,057 - mu.logic:564(init) INFO: Log directory: /home/phil/.cache/mu/log 2022-09-28 14:14:28,057 - mu.logic:565(init) INFO: Data directory: /home/phil/.local/share/mu 2022-09-28 14:14:28,063 - mu.logic:578(setup) INFO: Available modes: python, adafruit, microbit, debugger, pygamezero 2022-09-28 14:14:28,125 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/phil/mu_code 2022-09-28 14:14:28,126 - mu.logic:625(restore_session) INFO: Restoring session from: /home/phil/.local/share/mu/session.json 2022-09-28 14:14:28,126 - mu.logic:626(restore_session) DEBUG: {'theme': 'day', 'mode': 'microbit', 'paths': ['/home/phil/mu_code/rats.com.py'], 'envars': [], 'minify': False, 'microbit_runtime': '', 'zoom_level': 2} 2022-09-28 14:14:28,126 - mu.logic:713(_load) INFO: Loading script from: /home/phil/mu_code/rats.com.py 2022-09-28 14:14:28,126 - mu.logic:274(read_and_decode) DEBUG: Trying to decode with utf-8 2022-09-28 14:14:28,126 - mu.logic:277(read_and_decode) INFO: Decoded with utf-8 2022-09-28 14:14:28,126 - mu.logic:290(read_and_decode) DEBUG: Detected newline '\n' 2022-09-28 14:14:28,127 - mu.logic:787(_load) DEBUG: # Write your code here :-)

RATS.com

from microbit import *

freq = 60

while true: if button_a.is_pressed(): freq = freq - 10 if button_b.is_pressed(): freq =freq + 10 if freq < 0: freq = 0 if freq > 100000: freq =100000 sleep(10)

2022-09-28 14:14:28,146 - mu.logic:647(restore_session) INFO: Loaded files. 2022-09-28 14:14:28,146 - mu.logic:650(restore_session) INFO: User defined environment variables: [] 2022-09-28 14:14:28,146 - mu.logic:654(restore_session) INFO: Minify scripts on micro:bit? False 2022-09-28 14:14:28,152 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/phil/mu_code 2022-09-28 14:14:34,392 - mu.logic:809(get_dialog_directory) INFO: Using path for file dialog: /home/phil/mu_code 2022-09-28 14:14:41,107 - mu.interface.main:251(get_load_path) DEBUG: Getting load path: /home/phil/mu_code/interupts4.py 2022-09-28 14:14:41,108 - mu.logic:713(_load) INFO: Loading script from: /home/phil/mu_code/interupts4.py 2022-09-28 14:14:41,108 - mu.logic:274(read_and_decode) DEBUG: Trying to decode with utf-8 2022-09-28 14:14:41,108 - mu.logic:277(read_and_decode) INFO: Decoded with utf-8 2022-09-28 14:14:41,109 - mu.logic:290(read_and_decode) DEBUG: Detected newline '\n' 2022-09-28 14:14:41,109 - mu.logic:787(_load) DEBUG: from microbit import * import machine

state=machine.disable_irq() sleep(1000) machine.enable_irq(state) display.scroll('Microbit')

carlosperate commented 2 years ago

Hi @rhubarbdog, thanks for the report. Mu version 1.0.2 is very old, would be able to install the latest version with any of the options listed in https://codewith.mu ?