Search found 20 matches

by NTL2009
Wed Jun 14, 2017 2:04 am
Forum: ESP8266 boards
Topic: Memory: Is "from X import Y" better than "import X"?
Replies: 3
Views: 3156

Re: Memory: Is "from X import Y" better than "import X"?

Thanks. Yes, I should probably look into compiling with mpy-cross, I've read about it here, just haven't made the jump to learning another tool yet. I familiar with some of the memory functions you mentioned, but I'll need to look again, I was thinking they only provide info after the compiling is d...
by NTL2009
Tue Jun 13, 2017 4:41 pm
Forum: ESP8266 boards
Topic: Memory: Is "from X import Y" better than "import X"?
Replies: 3
Views: 3156

Memory: Is "from X import Y" better than "import X"?

I'm occasionally getting errors when my ESP boots a new version of main.py, like: MemoryError: memory allocation failed, allocating 557 bytes Which I think I understand to be running out of memory as the ESP tries to compile the main.py file. I manage to find ways to reduce the code size or variable...
by NTL2009
Thu Dec 22, 2016 9:19 pm
Forum: ESP8266 boards
Topic: Just a "Thank You" and my project update
Replies: 7
Views: 5668

Re: Just a "Thank You" and my project update

Don't be too hard on yourself. Everybody was a beginner at some point. I'm definitely a beginner and when I look at my early code it amazes me that it ever ran at all (see #6 below) :shock: OK, here you go... http://forum.micropython.org/viewtopic.php?f=16&t=2804 Hah - I actually came across some v...
by NTL2009
Thu Dec 22, 2016 9:16 pm
Forum: ESP8266 boards
Topic: A basic socket server/client example from a beginner
Replies: 1
Views: 12940

Re: A basic socket server/client example from a beginner

Here's the ESP8266/MicroPython soide of things. NOTE - my ESP8266 is tied up on its main mission right now, so I wasn't able to test this stripped out code segment, hopefully I got all the extraneous variables pulled out, and it works this way, but I doubt it! Should be close though, I think. FIRST:...
by NTL2009
Thu Dec 22, 2016 8:53 pm
Forum: ESP8266 boards
Topic: A basic socket server/client example from a beginner
Replies: 1
Views: 12940

A basic socket server/client example from a beginner

I had a request to post this code. It might actually serve as an example of what NOT to do, but it is working for me. It is not 'pythonic' - I do use multiple statements per line and other things. Input is welcome, I have thick skin and would not put it up here if I weren't ready for (hopefully cons...
by NTL2009
Thu Dec 22, 2016 8:00 pm
Forum: ESP8266 boards
Topic: Just a "Thank You" and my project update
Replies: 7
Views: 5668

Re: Just a "Thank You" and my project update

Hi NTL, Your project sounds great. I'll also send out a "thank you" to the MicroPython community for all of the hard work and excellent results. Would you care to share any details and/or code on how you upload and download the data with sockets? I'd like to do that from my esp8266 and haven't look...
by NTL2009
Wed Dec 21, 2016 6:48 pm
Forum: ESP8266 boards
Topic: Just a "Thank You" and my project update
Replies: 7
Views: 5668

Just a "Thank You" and my project update

Most posts in a forum like this will be about problems, so I thought I'd take a minute to just say “Thanks” to the developers of MicroPython, and to the posters here who contribute to help out others, and to speak to my little successes. So... “Thanks!”. Just a little background on what I've done wi...
by NTL2009
Thu Nov 24, 2016 1:55 pm
Forum: ESP8266 boards
Topic: How can I trap socket errors?
Replies: 13
Views: 20451

Re: How can I trap socket errors?

Thanks for the added info. I will try working with the added suggestions to be more specific in the error trap. That may be a while, lately, as I've been adding some 'nice to haves' to my app as I do more thorough testing/beating, I have been running into memory errors as it attempts to load my main...
by NTL2009
Wed Nov 23, 2016 3:24 am
Forum: ESP8266 boards
Topic: How can I trap socket errors?
Replies: 13
Views: 20451

Re: How can I trap socket errors?

OK, got a chance to add the above code sample into my code (within a function), and all works as I wanted. s = socket.socket() time.sleep(0.1) try: s.connect((host, port)) except Exception as err: print("Exception", err) return # continue if connected And this is the err if no server is running: [Er...
by NTL2009
Tue Nov 22, 2016 2:42 pm
Forum: ESP8266 boards
Topic: How can I trap socket errors?
Replies: 13
Views: 20451

Re: How can I trap socket errors?

Thanks so much! I will try these later today and report back. Looks like the key is to use the "except Exception as err:" instead of my attempt with " except socket.error". Fortunately, the way I have my app arranged, I store the events I'm monitoring in a file (ON/OFF changes in state of an applian...