From 1258757fc7ae26d1aa305041cecdf0be3e04b088 Mon Sep 17 00:00:00 2001 From: Vladimir Rudnyh Date: Tue, 21 Mar 2017 15:01:29 +0300 Subject: [PATCH] Python errors handling in 'pyedit' command Do now show python warnings (import or syntax) if module name is bad. --- plugins/available/python.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/python.plugin.bash b/plugins/available/python.plugin.bash index ad7e4069..ceba6268 100644 --- a/plugins/available/python.plugin.bash +++ b/plugins/available/python.plugin.bash @@ -14,7 +14,7 @@ function pyedit() { example '$ pyedit requests' group 'python' - xpyc=`python -c "import sys; stdout = sys.stdout; sys.stdout = sys.stderr; import $1; stdout.write($1.__file__)"` + xpyc=`python -c "import os, sys; f = open(os.devnull, 'w'); sys.stderr = f; module = __import__('$1'); sys.stdout.write(module.__file__)"` if [ "$xpyc" == "" ]; then echo "Python module $1 not found"