Search found 8 matches

by johanson
Sun May 30, 2021 9:48 pm
Forum: General Discussion and Questions
Topic: datetime not working out of the box
Replies: 18
Views: 17851

Re: datetime not working out of the box

Having seen positive signs of activity in the micropython-lib repo I've submitted two PRs. Let's see how that goes. :P
by johanson
Sat May 29, 2021 10:01 am
Forum: General Discussion and Questions
Topic: ETIMEOUT trying to catch error in usocket
Replies: 7
Views: 4560

Re: ETIMEOUT trying to catch error in usocket

OSError does not have __str__ implemented so the implicit conversion to str fails and you get TypeError: can't convert 'OSError' object to str implicitly . You can handle the exception based on the error code as follows: try: addr = usocket.getaddrinfo(host, port)[0][-1] except OSError as err: if er...
by johanson
Sat May 29, 2021 9:12 am
Forum: General Discussion and Questions
Topic: ETIMEOUT trying to catch error in usocket
Replies: 7
Views: 4560

Re: ETIMEOUT trying to catch error in usocket

Check your indentation, the except OSError should be aligned with try, or remove the try/except block from within except block completely. Appending into the file should not be raising any OSError at all until things are seriously wrong.
by johanson
Tue May 25, 2021 7:08 pm
Forum: General Discussion and Questions
Topic: checking a value across lots of Constants
Replies: 3
Views: 3780

Re: checking a value across lots of Constants

Typically, I would do this sort of thing with enumerate, which is not available in Micropython
Enumerate is a part of MicroPython, maybe the typical way you mention is actually possible.
by johanson
Tue May 25, 2021 9:05 am
Forum: General Discussion and Questions
Topic: datetime not working out of the box
Replies: 18
Views: 17851

Re: datetime not working out of the box

I will check if a consolidated PR exists for all these fixes and may open one in near future if one isn't already on Github. I did not get to run any tests as I was happy with the fixes and continued work on my project that uses datetime. I will run tests when I work on the PR.
by johanson
Sat May 22, 2021 3:34 pm
Forum: General Discussion and Questions
Topic: datetime not working out of the box
Replies: 18
Views: 17851

Re: datetime not working out of the box

I know, that's why I am asking here instead of straight submitting new PRs with confidence that they will be merged in my lifetime. It's a sad state of micropython-lib. I'll monitor the repo and the forum in case it picks up some activity in the future. Once again thank you all for pointing me in th...
by johanson
Sat May 22, 2021 2:40 pm
Forum: General Discussion and Questions
Topic: datetime not working out of the box
Replies: 18
Views: 17851

Re: datetime not working out of the box

Thank you, this is the kind of insight I don't have, being still relatively new to MicroPython. I will keep the changes inside my module and include original license information in the respective files. Who manages micropython-lib and why is there so little activity? Some packages could use fixes an...
by johanson
Sat May 22, 2021 1:57 pm
Forum: General Discussion and Questions
Topic: datetime not working out of the box
Replies: 18
Views: 17851

datetime not working out of the box

I've ported a package originally written for Python to MicroPython but in order to get it working I had to implement some fixes to datetime package from micropython-lib based on solutions I found online. Datetime installed via upip it does not even import without errors but I had to fix more than th...