question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: no such attribute

See original GitHub issue

Hello. It appears I’ve triggered an issue with Thonny 4.0:

Hopefully helpful background:

I just flashed a D1 Mini fine with Thonny 4.0 (also tried w/4.1) (w/‘dio’ mode) OK but cannnot get a REPL post reboot:

image

"PROBLEM IN THONNY'S BACK-END: Internal error (thonny.plugins.micropython.mp_back.ManagementError: Script produced errors).
See Thonny's backend.log for more info.
You may need to press "Stop/Restart" or hard-reset your MicroPython device and try again.


Process ended with exit code 0."

  • I can connect with gtkterm OK to get a REPL and I was able to download Thonny 3.X (I just grabbed an earlier version randomly) and get a REPL as well.

  • I have an esp32 connected via the other USB port so it seems like maybe this is D1 mini or esp8266 related (or maybe a bad D1? I just got it and never used them yet…)

Anyhow, here’s the backend.log

backend.log
21:34:22.443 INFO    thonny: Thonny version: 4.0.1
21:34:22.444 INFO    thonny: cwd: /home/john
21:34:22.444 INFO    thonny: original argv: ['/home/john/apps/thonny/bin/python3.10', '-u', '-B', '/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/esp/esp_back.py', "{'clean': True, 'port': '/dev/ttyUSB0', 'dtr': None, 'rts': None, 'submit_mode': None, 'interrupt_on_connect': False, 'write_block_size': None, 'write_block_delay': None, 'proxy_class': 'ESP8266Proxy', 'sync_time': True, 'validate_time': False, 'local_rtc': True}"]
21:34:22.444 INFO    thonny: sys.executable: /home/john/apps/thonny/bin/python3.10
21:34:22.444 INFO    thonny: sys.argv: ['/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/esp/esp_back.py', "{'clean': True, 'port': '/dev/ttyUSB0', 'dtr': None, 'rts': None, 'submit_mode': None, 'interrupt_on_connect': False, 'write_block_size': None, 'write_block_delay': None, 'proxy_class': 'ESP8266Proxy', 'sync_time': True, 'validate_time': False, 'local_rtc': True}"]
21:34:22.444 INFO    thonny: sys.path: ['/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/esp', '/home/john/apps/thonny/lib/python310.zip', '/home/john/apps/thonny/lib/python3.10', '/home/john/apps/thonny/lib/python3.10/lib-dynload', '/home/john/.local/lib/python3.10/site-packages', '/home/john/apps/thonny/lib/python3.10/site-packages']
21:34:22.444 INFO    thonny: sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=1, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=0, warn_default_encoding=0)
21:34:22.444 INFO    thonny.plugins.micropython.bare_metal_backend: Starting backend, args: {'clean': True, 'port': '/dev/ttyUSB0', 'dtr': None, 'rts': None, 'submit_mode': None, 'interrupt_on_connect': False, 'write_block_size': None, 'write_block_delay': None, 'proxy_class': 'ESP8266Proxy', 'sync_time': True, 'validate_time': False, 'local_rtc': True}
21:34:22.445 INFO    thonny.plugins.micropython.bare_metal_backend: Initial submit_mode: raw_paste, write_block_size: 127, write_block_delay: 0, read_block_size: 0
21:34:22.445 INFO    thonny.plugins.micropython.mp_back: Initializing MicroPythonBackend of type EspMicroPythonBackend
21:34:22.445 INFO    thonny: TIME/MODS 0.035 before prepare (+73 modules)
21:34:22.445 INFO    thonny: NEW MODS ['__future__', '_bz2', '_compression', '_datetime', '_heapq', '_lzma', '_posixsubprocess', '_queue', '_struct', '_tkinter', 'array', 'binascii', 'bz2', 'datetime', 'encodings.ascii', 'errno', 'faulthandler', 'fcntl', 'fnmatch', 'gettext', 'heapq', 'lzma', 'math', 'ntpath', 'pathlib', 'platform', 'queue', 'select', 'selectors', 'serial', 'serial.serialposix', 'serial.serialutil', 'shlex', 'shutil', 'signal', 'struct', 'subprocess', 'termios', 'textwrap', 'thonny.backend', 'thonny.base_file_browser', 'thonny.codeview', 'thonny.config_ui', 'thonny.editors', 'thonny.languages', 'thonny.misc_utils', 'thonny.plugins', 'thonny.plugins.backend_config_page', 'thonny.plugins.micropython', 'thonny.plugins.micropython.bare_metal_backend', 'thonny.plugins.micropython.connection', 'thonny.plugins.micropython.mp_back', 'thonny.plugins.micropython.mp_common', 'thonny.plugins.micropython.mp_front', 'thonny.plugins.micropython.serial_connection', 'thonny.plugins.micropython.webrepl_connection', 'thonny.roughparse', 'thonny.running', 'thonny.tktextext', 'thonny.ui_utils', 'thonny.workdlg', 'tkinter', 'tkinter.commondialog', 'tkinter.constants', 'tkinter.dialog', 'tkinter.filedialog', 'tkinter.font', 'tkinter.messagebox', 'tkinter.simpledialog', 'tkinter.ttk', 'urllib', 'urllib.parse', 'zlib']
21:34:22.446 INFO    thonny.plugins.micropython.mp_back: Sending interrupt
21:34:22.446 INFO    thonny.plugins.micropython.mp_back: Done sending interrupt
21:34:22.464 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: '\r\n'
21:34:22.474 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: ''
21:34:22.479 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: 'OK\r\n'
21:34:22.479 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: 'MPY: soft reboot\r\n'
21:34:22.506 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: ''
21:34:22.530 INFO    thonny: TIME/MODS 0.085 got welcome 
21:34:22.530 INFO    thonny: TIME/MODS 0.000 bef preparing helpers 
21:34:22.530 INFO    thonny.plugins.micropython.mp_back: Preparing helpers
21:34:22.530 INFO    thonny: TIME/MODS 0.000 befsubcode 
21:34:22.535 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: '\r\n'
21:34:22.545 INFO    thonny.plugins.micropython.bare_metal_backend: Discarding stdout: ''
21:34:22.680 INFO    thonny: TIME/MODS 0.150 affsubcode 
21:34:22.707 INFO    thonny: TIME/MODS 0.027 affforw 
21:34:22.707 INFO    thonny: TIME/MODS 0.000 prepared helpers 
21:34:22.707 INFO    thonny: TIME/MODS 0.000 befsubcode 
21:34:22.718 INFO    thonny: TIME/MODS 0.011 affsubcode 
21:34:22.744 INFO    thonny: TIME/MODS 0.026 affforw 
21:34:22.744 ERROR   thonny.plugins.micropython.mp_back: Exception in MicroPython main method
Traceback (most recent call last):
  File "/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/micropython/mp_back.py", line 151, in __init__
    self._prepare_after_soft_reboot(clean)
  File "/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/micropython/mp_back.py", line 185, in _prepare_after_soft_reboot
    self._update_cwd()
  File "/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/micropython/bare_metal_backend.py", line 458, in _update_cwd
    super()._update_cwd()
  File "/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/micropython/mp_back.py", line 449, in _update_cwd
    self._cwd = self._evaluate("__thonny_helper.getcwd()")
  File "/home/john/apps/thonny/lib/python3.10/site-packages/thonny/plugins/micropython/mp_back.py", line 571, in _evaluate
    raise ManagementError("Script produced errors", script, out, err)
thonny.plugins.micropython.mp_back.ManagementError: Script produced errors
21:34:22.744 ERROR   thonny.plugins.micropython.mp_back: ManagementError details:
SCRIPT: __thonny_helper.print_mgmt_value(__thonny_helper.getcwd())

STDOUT: 

STDERR: Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 42, in getcwd
AttributeError: no such attribute

This is on Ubuntu 22.04.1 LTS

(Thank you for a great IDE BTW, nothing else come close IMHO)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aivarannamaacommented, Nov 26, 2022

Thanks, this is good to know, at least for explaining next issues. I’m surprised that the “ESP8266 with 512kiB flash” version did not have the getwcd function, as if it didn’t have any filesystem at all.

0reactions
jouellnyccommented, Nov 26, 2022

Right. I figured it could be good to know. Sometimes mistakes (mine here) can be fruitful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: AttributeError
AttributeError can be defined as an error that is raised when an attribute reference or assignment fails. For example, if we take a...
Read more >
Why am I getting AttributeError: Object has no attribute?
Your indentation is goofed, and you've mixed tabs and spaces. Run the script with python -tt to verify.
Read more >
How to Fix AttributeError in Python
To avoid the AttributeError in Python code, a check should be performed before referencing an attribute on an object to ensure that it...
Read more >
Python AttributeError: A How-To Guide
Attribute errors in Python are raised when an invalid attribute is referenced. To solve these errors, first check that the attribute you are ......
Read more >
AttributeError: 'module' object has no attribute 'main'
Module object has no attribute error: Python ... An attribute in Python means some property that is associated with a particular type of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found