SpenceKonde / AVR-Guidance

A guide to best practices when using the Arduino IDE to program AVR microcontrollers
150 stars 23 forks source link

Collections has no attribue Hashable #9

Closed dork3nergy closed 1 year ago

dork3nergy commented 2 years ago

Not sure if this is an issue on my side but, I get this error trying to upload.

My python version is 3.10.2


SerialUPDI UPDI programming for Arduino using a serial adapter Based on pymcuprog, with significant modifications By Quentin Bolsee and Spence Konde Version 1.2.3 - Jan 2022 Using serial port /dev/ttyUSB0 at 460800 baud. Target: attiny1614 Set fuses: ['2:0x01', '6:0x04', '8:0x00'] Action: write File: /tmp/arduino_build_669110/Blink.ino.hex Traceback (most recent call last): File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/prog.py", line 285, in main() File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/prog.py", line 127, in main An error occurred while uploading the sketch setup_logging(user_requested_level=logging_level) File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/pymcuprog/pymcuprog.py", line 47, in setup_logging configfile = yaml.safe_load(file) File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/init.py", line 94, in safe_load return load(stream, SafeLoader) File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/init.py", line 72, in load return loader.get_single_data() File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/constructor.py", line 37, in get_single_data return self.construct_document(node) File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/constructor.py", line 46, in construct_document for dummy in generator: File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/constructor.py", line 398, in construct_yaml_map value = self.construct_mapping(node) File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/constructor.py", line 204, in construct_mapping return super().construct_mapping(node, deep=deep) File "/home/eturd/.arduino15/packages/megaTinyCore/hardware/megaavr/2.5.10/tools/libs/yaml/constructor.py", line 126, in construct_mapping if not isinstance(key, collections.Hashable): AttributeError: module 'collections' has no attribute 'Hashable'

dork3nergy commented 2 years ago

YAML has changed.

Change collections.hasable on line 126 in constructor.py to collections.abc.hashable

SpenceKonde commented 2 years ago

This seems complicated, because we have to make sure that any change doesn't break compatibility for any of the platformws which this change doesn't occur on. Note that on windows installing the core brings in it's in it's own static installation of python (we also package every library that we use, to my knowledge, hoping in vain that it would ward off crap like this. , whereas linux and mac use the system installation. I don;t know how you're supposed to handle things like this - I'm a C programmer, not a python programmer.

(And I can'r run the risk of another run of patches that break stuff for people; 2.5.11 is coming out end of week most likely with yet another critical bugfix that should finally fix the new attcachInterrupt bug. 2.5.0 came out just before xmas, and every release since then has been a critical bugfix.

What are people writing code that is supposed to run on multiple versions of python suopposed to do? How do we test for what's present, like we do using #ifdef's in C, so we can be sure that the new code deson't get run on parts with old versions that aren;'t compatible with it.

dork3nergy commented 2 years ago

I see your point. You can pull in the version of python running your script and then have some if statements to deal with different version levels.

Although the collections.abc.hashable fixes the error for me, I am still unable to write to the chip. Since this is my first shot at this I'm not positive the problem isn't somewhere else. If you don't mind, I will send you an email via tindie (I have some of your dev boards) to elaborate.

SpenceKonde commented 1 year ago

This issue has been fixed as far as I am aware in recent versions of SerialUPDI.