0
# shopt -s extglob
# python3
Python 3.4.0 (default, Sep 8 2015, 23:36:36)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess import check_call
>>> check_call(['shopt', '-s', 'extglob'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/subprocess.py", line 552, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python3.4/subprocess.py", line 533, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.4/subprocess.py", line 848, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1446, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'shopt'
shopt не кажется, на моем пути, но Баш делает:Почему при выходе из python происходит сбой магазина?
# echo $PATH | grep shopt
# whereis shopt
# whereis bash
bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
Я предполагаю, что это не на вашем пути? –
'shopt' - это встроенная bash, а не команда (т. Е. Исполняемый файл где-то в' PATH'). –
'check_call (['/ bin/bash', '-c', 'shopt -s extglob'])' работает. но затем оболочка завершает работу и настройки теряются ... –