TypeError: 'SelfWrapper' object is not callable
MiaoheLin opened this issue · comments
linmiaohe commented
I'm newbie to python and sh, I meet a problem when using sh. It's very kind of you if you could help me.
I want to use the _cwd to set the current working directory of a new shell. But I got the below error:
[root@hce2 kernel]# python3
Python 3.9.9 (main, Feb 9 2022, 09:00:41)
[GCC 10.3.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sh
>>> sh(_cwd="/root/")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'SelfWrapper' object is not callable
Is there anything wrong? Or I just misunderstand the sh(_cwd)?
Many thanks in advace.
Erik Cederstrand commented
Since version 2.0 this syntax has been deprecated. Instead, use the sh.bake()
method. See https://github.com/amoffat/sh/blob/develop/MIGRATION.md#removed-execution-contexts--default-arguments
linmiaohe commented
That works for me. Many thanks for your reply!