Skip to content

Overriding default arguments for all command fails #440

Closed
@hirenvadalia

Description

@hirenvadalia

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions