Comments (8)
I worked around this by adding a stub class.
class StreamHandler:
def __init__(self, stream=None):
self.stream = stream
self.terminator = '\n'
def emit(self, record):
pass
def flush(self):
pass
def setStream(self, stream):
old_stream = self.stream
self.stream = stream
return old_stream
and a stub method
class Logger:
def addHandler(self, handler):
pass
This is a Python 3.8 feature which MicroPython doesn't explictly support.
from pysm.
This is actually a great idea. Will have a look at it.
from pysm.
I started to tinker with pyboards only recently and for what it's worth I tweaked the pysm internals a bit to make it work with pyboards.
I tested it against the ESP-32S board and works flawlessly.
See the https://github.com/pgularski/upysm/ for details.
One can install it basically with
import upip; pip.install('upysm')
Provided there's wifi support.
from pysm.
Just wanted to say thanks! Recently I've been looking for a state machine module that I could use in MicroPython and had resigned myself to porting or creating a new library. pysm
is exactly what I was looking for! Thanks again for going to the trouble to add MicroPython compatibility.
from pysm.
Wow, for comments like this it's well worth sharing one's work as the open source software. Totally appreciate your feedback, Matt! Thanks!
from pysm.
Hi, a commit has broken MicroPython compatibility, 1fde9e1#diff-5225765ccd6201cc9a3f939e749fb117R10
MicroPython does not have a logging.StreamHandler
class. This has landed in upysm
from pysm.
Hi @nevercast ,
Thanks for having a look and letting me know. The logging WAS working last time I was testing the pysm library, so either you've got a different version of MicroPython or something has changed.
The workaround you sent is actually pretty much what I'd suggest. One more thing though, I'd wrap the import logging statement in the try/except block and would call your stub code only if the import of the logging module fails.
I'll take a look at it some time this week, hopefully. I don't have much time now tho and my ESP32 is somewhere around... I do have it, I swear :)
If you could craft a pull request, preferably with some tests, I'd appreciate it.
Once again, thanks for using the pysm module!
from pysm.
I'm using the ESP32 port on MicroPython#master at https://github.com/micropython/micropython. The logging
library, and collections.[deque|defaultdict]
libraries came from https://github.com/micropython/micropython-lib. (I'm not using the native deque library at this time because you've used kwargs in your driver and the native library doesn't work with kwargs)
I'd say this port is probably the reference implementation, but I understand you may want to support ESP8266 also.
from pysm.
Related Issues (10)
- Images for README HOT 3
- State object missing from upysm HOT 1
- Are your recursive PDA's as powerful as a Turing machine? Are regular expression edges supported?
- Entry event on initialization HOT 1
- Get the availiable states from a given state HOT 2
- Pushing items into an empty stack on micropyhton esp32 HOT 5
- Accessing self.sm.leaf_state from a event-handler returns wrong state HOT 1
- store/restore of the state stack. HOT 2
- Not returning to initial state after exit HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysm.