Closed
Description
As mentioned in https://amoffat.github.io/sh/sections/default_arguments.html#default-arguments, overriding default arguments for all further command fails as below:
>>> import sh
>>> from io import StringIO
>>> buf = StringIO()
>>> sh2 = sh(_out=buf)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/sh.py", line 3367, in __call__
code = parent[4][0].strip()
TypeError: 'NoneType' object has no attribute '__getitem__'
>>>
And after adding below two line at 3368 (after parent = inspect.stack()[1])
it worked:
if parent[4] is None:
return new_mod
Metadata
Metadata
Assignees
Labels
No labels