Skip to content

Conversation

@zh794390558
Copy link
Contributor

add set -e for python -c "import mmseg" 2>/dev/null || \ (echo "mmseg is not found. Checkout tools/extra/install_mmseg.sh" && exit 1;) not exit as expected.

add `set -e` for `python -c "import mmseg" 2>/dev/null || \ (echo "mmseg is not found. Checkout tools/extra/install_mmseg.sh" && exit 1;)` not exit as expected.
@kkm000
Copy link
Contributor

kkm000 commented Apr 17, 2019

Thanks. set -e in itself is not wrong.

As for the code,

#transcripts normalization and segmentation
#(this needs external tools),
python -c "import mmseg" 2>/dev/null || \
(echo "mmseg is not found. Checkout tools/extra/install_mmseg.sh" && exit 1;)

the echo and exit are run in a subshell. The exit exits the subshell with code 1 and returns back to the program, which continues to run happily This is the actual bug.. What was intended here was running the echo and exit in a group command instead of a subshell:

python -c "import mmseg" 2>/dev/null || { echo "mmseg is not found. Checkout tools/extra/install_mmseg.sh"; exit 1; }

If you are up to helping with a better fix, please fix this bug. Also, move the whole check to an earlier point, so the script fails quickly if the module is not found. I'd put as early as before the first mkdir at the line 18. And even better, I'd reword the error message for clarity, "Python module mmseg is not found. To install it, run tools/extra/install_mmseg.sh".

@zh794390558
Copy link
Contributor Author

thanks for you recommendation。

@zh794390558
Copy link
Contributor Author

please check.


# transcripts normalization and segmentation
# needs external tools
python -c "import mmseg" 2>/dev/null || {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think invoking this as python2.7 would be better, since mmseg doesn't work on python3, IIRC. Obviously we should make sure that the script that actually uses mmseg later on also invokes it that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@danpovey danpovey merged commit d47e36c into kaldi-asr:master Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants