diff --git a/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh b/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh index ebc94e076c8..15d2bd0eb34 100644 --- a/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh @@ -26,7 +26,9 @@ pythonNamespacesHook() { # remove __pycache__/ entry, can be interpreter specific. E.g. __init__.cpython-38.pyc # use null characters to perserve potential whitespace in filepath - @findutils@/bin/find $pycachePath -name '__init__*' -print0 | xargs -0 rm -v + if [ -d "$pycachePath" ]; then + @findutils@/bin/find "$pycachePath" -name '__init__*' -exec rm -v "{}" + + fi done done