amoffat / sh

Python process launching

Home Page:https://sh.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sh doesn't print output unless wrapped in print()

devinnasar opened this issue · comments

According to the documentation, commands such as the following should print to the console when called:

  • sh.git.status()
  • sh.ls()
  • etc.

The documentation has the user calling these commands verbatim, and not wrapped in print(). Can someone explain this? Am I doing it wrong?

The commands return a string. If you execute them from the python console, python will print the result. If you execute them from a script, you need to print the result yourself.