"Fossies" - the Fresh Open Source Software Archive

Member "http-prompt-2.1.0/tests/utils.py" (5 Mar 2021, 623 Bytes) of package /linux/www/http-prompt-2.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "utils.py" see the Fossies "Dox" file reference documentation.

    1 import os
    2 import sys
    3 
    4 
    5 def get_http_prompt_path():
    6     """Get the path to http-prompt executable."""
    7     python_dir = os.path.dirname(sys.executable)
    8     bin_name = 'http-prompt'
    9     if sys.platform == 'win32':
   10         bin_name += '.exe'
   11 
   12     paths = [
   13         os.path.join(python_dir, bin_name),
   14         os.path.join(python_dir, 'Scripts', bin_name),  # Windows
   15         '/usr/bin/http-prompt'  # Homebrew installation
   16     ]
   17     for path in paths:
   18         if os.path.exists(path):
   19             return path
   20 
   21     raise OSError("could not locate http-prompt executable, "
   22                   "Python directory: %s" % python_dir)