Search found 28 matches

by francis
Tue Jun 21, 2022 4:23 pm
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

In CPython this works >>> dut=b'hello' >>> dut.index(101) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't convert 'int' object to str implicitly I don't think it would take much resources to make it work in micropython, so I guess it is a bug. The error messag...
by francis
Tue Jun 07, 2022 5:38 pm
Forum: General Discussion and Questions
Topic: Avatar picture size
Replies: 3
Views: 1054

Re: Avatar picture size

Thanks for reminding me of my old friend mogrify (imagemagick, convert)
It had fallen out of my auto application installer
by francis
Mon Jun 06, 2022 7:51 pm
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

You won't improve support by complaining about the quality of the free support you're getting. I think it's probably a simple bug in bytes.index() being too particular about types This might help you. Have you installed micropython for unix. It's great for quick and dirty tests like this MicroPython...
by francis
Mon Jun 06, 2022 3:34 pm
Forum: General Discussion and Questions
Topic: Avatar picture size
Replies: 3
Views: 1054

Avatar picture size

I notice most people don't have a picture on their profile. Today I decided to be good and entertain you with my face. The maximum photo size is 90x90 pixels and 8kB. 8 kB is absurd. I used gimp to crop a photo to 90x90, reduced quality to 0 and it still came out at 15kB I simply can't make an avata...
by francis
Mon Jun 06, 2022 9:31 am
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

Whether it's a bug or a design decision based on micropython's memory constraints Here is an easy workaround. Just convert it to a list or tuple. MicroPython v1.18-421-ge3c880a56 on 2022-05-15; linux [GCC 11.2.0] version Use Ctrl-D to exit, Ctrl-E for paste mode >>> x = b'\x02abcdefg\x03' >>> x.inde...
by francis
Sun Jun 05, 2022 5:30 pm
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

Do you want to work with the Python you have or design your ideal language? And have a look at Array.Array There you can certainly define an array of int8 or int16 > I think you know what I meant. No need to slice and dice between words. Actually I though you were confused. C has a byte type (char),...
by francis
Sun Jun 05, 2022 5:01 pm
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

>>> a = bytearray([3,4,5,6]) >>> a[2:2] = b'\x10' >>> a bytearray(b'\x03\x04\x10\x05\x06') If you look carefully you are inserting 10 in the middle of the mutable bytearray extending it from 4 to 5 elements >>> x='ä' >>> x 'ä' >>> ord(x) 228 >>> xx=x.encode('UTF-8') >>> xx b'\xc3\xa4' >>> type(xx) ...
by francis
Sun Jun 05, 2022 4:38 pm
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

Everything I said is correct except: b'\x03' is indeed an immutable bytes, not a mutable bytearray. Sorry about that > isn't a bytearray of length 1. It's a bytes object. In other words, a single byte of value 3. No it's an immutable byte array of length 1. There is no such thing as a single byte. I...
by francis
Sun Jun 05, 2022 12:30 pm
Forum: General Discussion and Questions
Topic: Is this another bug, or a feature?
Replies: 20
Views: 8852

Re: Is this another bug, or a feature?

It is actually perfectly logical. A bytearray is an array of ints, but ints limited to 0..255 b"\x03" is a bytearray of length 1 containing the int 3 You must assign d[5] to an int from 0..255. b"\x03" cannot fit in d[5] because it's not an int The surprising this is that ord(b"\x07") produces the i...
by francis
Thu May 26, 2022 10:46 am
Forum: Raspberry Pi microcontroller boards
Topic: help with E32 program (simple)
Replies: 25
Views: 8319

Re: help with E32 program (simple)

Sorry but you're being ridiculous The documentation, and every answer here tells uart.read() delivers as many characters as possible. The only reason for believing uart.read() delivers just one character is because you want it to be so. Everything else from documentation to every single answer here ...