Fixed typos and improved fix for #231

    * Fixed misspelled word environment in error message
    * Improved condition to show try to get the python_environment in
      the hook file depending on the view identification