blog.humaneguitarist.org
Kiddo added to GitHub
[Wed, 03 Jul 2019 18:31:38 +0000]
When I'm trying to work quickly and need to execute a small script through Python - it can be a pain.
I just uploaded a library to GitHub called Kiddo that tries to alleviate that a bit. You can see the repo at https://github.com/nitaro/kiddo [https://github.com/nitaro/kiddo].
Here's a usage example with Python 3:
>>> import logging
>>> logging.basicConfig(level=logging.INFO)
>>> import kiddo
>>> kid = kiddo.Kiddo("hiKiddo")
>>> kidding = kid.run("py -3 tests/echo_max_line.py 123")
INFO:hiKiddo:123
>>> return_code, stderr = kidding
>>> return_code
0
>>> stderr
[]
Using a log handler allows one to send the STDOUT to a log file or an in-memory logging object, etc.