April 30, 2016 will

Capturing standard output in Python (and posting it online)

Just landed in inthing is a new and quite interesting feature.

Version 0.1.4 adds a capture method which will record all standard output, i.e. anything you print to the terminal. It works as a context manager. Here's an example:

from inthing import Stream
stream = Stream.new()
with stream.capture() as capture:
    import this


Any print statement inside the with block will be captured and posted online with the block exits.

You can also do something similar from the command line, with the inthing capture subcommand, which posts anything you pipe in to it as an event.

lets say you wanted to post the version of all you installed Python packages online. You could do something like the following:

pip freeze | inthing capture -b

For more information see the Inthing docs.

Inthing is still technically in beta, but these features are quite solid. Please give them a try, and let me know how it goes!

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
Friti Gern

Hi Will, thanks for your work on inthing.

in Ubuntu 14.04 I got an error.




schlangenbrut@aroldo-UX31LA:~$ python --version Python 3.4.4 :: Continuum Analytics, Inc. schlangenbrut@aroldo-UX31LA:~$ pip --version pip 8.1.1 from /home/schlangenbrut/.local/lib/python3.4/site-packages (python 3.4) schlangenbrut@aroldo-UX31LA:~$ pip install inthing Collecting inthing Requirement already satisfied (use --upgrade to upgrade): pillow>=3.1.1 in ./.local/lib/python3.4/site-packages (from inthing) Requirement already satisfied (use --upgrade to upgrade): requests in ./.local/lib/python3.4/site-packages (from inthing) Installing collected packages: inthing Successfully installed inthing-0.1.4 schlangenbrut@aroldo-UX31LA:~$ inthing -v Traceback (most recent call last): File "/home/schlangenbrut/.local/bin/inthing", line 11, in <module> sys.exit(main()) File "/home/schlangenbrut/.local/lib/python3.4/site-packages/inthing/command/app.py", line 77, in main return inthing.run() File "/home/schlangenbrut/.local/lib/python3.4/site-packages/inthing/command/app.py", line 46, in run importlib.import_module('.' + name, 'inthing.command.sub') File "/home/schlangenbrut/.local/lib/python3.4/importlib/init.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap="">", line 2254, in _gcd_import File "<frozen importlib._bootstrap="">", line 2237, in _find_and_load File "<frozen importlib._bootstrap="">", line 2224, in _find_and_load_unlocked ImportError: No module named 'inthing.command.sub.event' schlangenbrut@aroldo-UX31LA:~$

Will McGugan

Sorry about that! Pushed a fix. Can you try an upgrade (v0.1.5)?

pip install inthing -U