Python pip._internal.exceptions.PipError() Examples
The following are 30
code examples of pip._internal.exceptions.PipError().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pip._internal.exceptions
, or try the search function
.
Example #1
Source File: __init__.py From deepWordBug with Apache License 2.0 | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
Example #2
Source File: configuration.py From FuYiSpider with Apache License 2.0 | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #3
Source File: __init__.py From FuYiSpider with Apache License 2.0 | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parseopts(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args)
Example #4
Source File: __init__.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
Example #5
Source File: configuration.py From FuYiSpider with Apache License 2.0 | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #6
Source File: __init__.py From Python24 with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parseopts(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args)
Example #7
Source File: __init__.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
Example #8
Source File: configuration.py From Python24 with MIT License | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #9
Source File: configuration.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #10
Source File: configuration.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #11
Source File: __init__.py From pySINDy with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
Example #12
Source File: __init__.py From FuYiSpider with Apache License 2.0 | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parseopts(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args)
Example #13
Source File: __init__.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
Example #14
Source File: configuration.py From pySINDy with MIT License | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #15
Source File: configuration.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #16
Source File: configuration.py From deepWordBug with Apache License 2.0 | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #17
Source File: __init__.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parseopts(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args)
Example #18
Source File: configuration.py From hacktoberfest2018 with GNU General Public License v3.0 | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #19
Source File: configuration.py From pex with Apache License 2.0 | 6 votes |
def _determine_file(self, options, need_value): file_options = [key for key, value in ( (kinds.USER, options.user_file), (kinds.GLOBAL, options.global_file), (kinds.SITE, options.site_file), ) if value] if not file_options: if not need_value: return None # Default to user, unless there's a site file. elif any( os.path.exists(site_config_file) for site_config_file in get_configuration_files()[kinds.SITE] ): return kinds.SITE else: return kinds.USER elif len(file_options) == 1: return file_options[0] raise PipError( "Need exactly one file to operate upon " "(--user, --site, --global) to perform." )
Example #20
Source File: __init__.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=("--isolated" in cmd_args)) return command.main(cmd_args)
Example #21
Source File: __init__.py From hacktoberfest2018 with GNU General Public License v3.0 | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parseopts(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args)
Example #22
Source File: configuration.py From hacktoberfest2018 with GNU General Public License v3.0 | 6 votes |
def _determine_file(self, options, need_value): file_options = { kinds.USER: options.user_file, kinds.GLOBAL: options.global_file, kinds.VENV: options.venv_file } if sum(file_options.values()) == 0: if not need_value: return None # Default to user, unless there's a virtualenv file. elif os.path.exists(venv_config_file): return kinds.VENV else: return kinds.USER elif sum(file_options.values()) == 1: # There's probably a better expression for this. return [key for key in file_options if file_options[key]][0] raise PipError( "Need exactly one file to operate upon " "(--user, --venv, --global) to perform." )
Example #23
Source File: __init__.py From hacktoberfest2018 with GNU General Public License v3.0 | 6 votes |
def main(args=None): if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parseopts(args) except PipError as exc: sys.stderr.write("ERROR: %s" % exc) sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, '') except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args)
Example #24
Source File: configuration.py From hacktoberfest2018 with GNU General Public License v3.0 | 5 votes |
def open_in_editor(self, options, args): editor = self._determine_editor(options) fname = self.configuration.get_file_to_edit() if fname is None: raise PipError("Could not determine appropriate file.") try: subprocess.check_call([editor, fname]) except subprocess.CalledProcessError as e: raise PipError( "Editor Subprocess exited with exit code {}" .format(e.returncode) )
Example #25
Source File: configuration.py From hacktoberfest2018 with GNU General Public License v3.0 | 5 votes |
def _get_n_args(self, args, example, n): """Helper to make sure the command got the right number of arguments """ if len(args) != n: msg = ( 'Got unexpected number of arguments, expected {}. ' '(example: "{} config {}")' ).format(n, get_prog(), example) raise PipError(msg) if n == 1: return args[0] else: return args
Example #26
Source File: configuration.py From pySINDy with MIT License | 5 votes |
def _save_configuration(self): # We successfully ran a modifying command. Need to save the # configuration. try: self.configuration.save() except Exception: logger.error( "Unable to save configuration. Please report this as a bug.", exc_info=1 ) raise PipError("Internal Error.")
Example #27
Source File: configuration.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
def _get_n_args(self, args, example, n): """Helper to make sure the command got the right number of arguments """ if len(args) != n: msg = ( 'Got unexpected number of arguments, expected {}. ' '(example: "{} config {}")' ).format(n, get_prog(), example) raise PipError(msg) if n == 1: return args[0] else: return args
Example #28
Source File: configuration.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _save_configuration(self): # We successfully ran a modifying command. Need to save the # configuration. try: self.configuration.save() except Exception: logger.error( "Unable to save configuration. Please report this as a bug.", exc_info=1 ) raise PipError("Internal Error.")
Example #29
Source File: configuration.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def open_in_editor(self, options, args): editor = self._determine_editor(options) fname = self.configuration.get_file_to_edit() if fname is None: raise PipError("Could not determine appropriate file.") try: subprocess.check_call([editor, fname]) except subprocess.CalledProcessError as e: raise PipError( "Editor Subprocess exited with exit code {}" .format(e.returncode) )
Example #30
Source File: configuration.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
def _get_n_args(self, args, example, n): """Helper to make sure the command got the right number of arguments """ if len(args) != n: msg = ( 'Got unexpected number of arguments, expected {}. ' '(example: "{} config {}")' ).format(n, get_prog(), example) raise PipError(msg) if n == 1: return args[0] else: return args