Unrecognized commands in bash are captured by the python interpreter -
every time try invoke command not exist ($ a
, example) in console (/bin/bash) interpreter waits long time. , when interrupt (^c), error message python interpreter. instead of that, expect tell me command unrecognized. why happening?
$ ^c traceback (most recent call last): file "/usr/lib/python2.7/encodings/__init__.py", line 32, in <module> root@dell:/home/antonio/workspace/biz_index# encodings import aliases file "/usr/lib/python2.7/encodings/aliases.py", line 17, in <module> """ keyboardinterrupt ^c
if setting path=""
fixes it, something, somewhere shadowing python package getting called command-not-found
package. did myself writing script called struct.py
. need go through every directory in path, i.e.
/home/antonio/.local/bin /home/antonio/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games
and .py
files there. 1 of them shares name 1 of builtin python packages. alternatively, can remove directories path
, add them in until find out 1 breaks it. once find it, need delete or rename it.
here's shell one-liner you:
for dir in $(echo $path | tr ":" "\n"); ls -1 $dir | grep "[.]py"; done
you can test out in own shell trying following (recreating mistake few days ago):
echo 'print("hello world")' >> struct.py
now in shell, staying in current directory, see:
➜ client git:(master) ✗ hello world zsh: command not found:
presumably python script doing shadowing in case doing more resource-intensive printing "hello world", hence hanging.
Comments
Post a Comment