Python sys.platform.lower() Examples
The following are 6
code examples of sys.platform.lower().
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
sys.platform
, or try the search function
.
Example #1
Source File: cbc.py From python-mip with Eclipse Public License 2.0 | 6 votes |
def read(self, file_path: str) -> None: if not isfile(file_path): raise FileNotFoundError("File {} does not exists".format(file_path)) if file_path.lower().endswith(".gz") and cbclib.Cbc_supportsGzip() == CHAR_ZERO: raise MipBaseException("CBC not compiled with gzip support") if ( file_path.lower().endswith(".bz2") and cbclib.Cbc_supportsBzip2() == CHAR_ZERO ): raise MipBaseException("CBC not compiled with bzip2 support") fpstr = file_path.encode("utf-8") if ".mps" in file_path.lower(): cbclib.Cbc_readMps(self._model, fpstr) elif ".lp" in file_path.lower(): cbclib.Cbc_readLp(self._model, fpstr) else: raise ValueError( "Enter a valid extension (.lp or .mps) \ to indicate the file format" )
Example #2
Source File: core.py From marker with MIT License | 5 votes |
def get_os(): if platform.lower() == 'darwin': return 'osx' elif platform.lower().startswith('linux'): return 'linux' else: # throw is better return 'unknown'
Example #3
Source File: captcha_handler.py From PokemonGo-Bot with MIT License | 5 votes |
def get_token(self, url): token = '' path = os.getcwd() if _platform == "Windows" or _platform == "win32": # Check if we are on 32 or 64 bit file_name= 'chromedriver.exe' if _platform.lower() == "darwin": file_name= 'chromedriver' if _platform.lower() == "linux" or _platform.lower() == "linux2": file_name = 'chromedriver' full_path = '' if os.path.isfile(path + '/' + file_name): # check local dir first full_path = path + '/' + file_name if full_path == '': self.bot.logger.error(file_name + ' is needed for manual captcha solving! Please place it in the bots root directory') sys.exit(1) try: driver = webdriver.Chrome(full_path) driver.set_window_size(600, 600) except Exception: self.bot.logger.error('Error with Chromedriver, please ensure it is the latest version.') sys.exit(1) driver.get(url) elem = driver.find_element_by_class_name("g-recaptcha") driver.execute_script("arguments[0].scrollIntoView(true);", elem) self.bot.logger.info('You have 1 min to solve the Captcha') try: WebDriverWait(driver, 60).until(EC.text_to_be_present_in_element_value((By.NAME, "g-recaptcha-response"), "")) token = driver.execute_script("return grecaptcha.getResponse()") driver.close() except TimeoutException, err: self.bot.logger.error('Timed out while trying to solve captcha')
Example #4
Source File: os_utils.py From sentinelhub-py with MIT License | 5 votes |
def sys_is_windows(): """ Check if user is running the code on Windows machine :return: `True` if OS is Windows and `False` otherwise :rtype: bool """ return platform.lower().startswith('win')
Example #5
Source File: platform_linux.py From scalyr-agent-2 with Apache License 2.0 | 5 votes |
def can_handle_current_platform(self): """Returns true if this platform object can handle the server this process is running on. @return: True if this platform instance can handle the current server. @rtype: bool """ return _platform.lower().startswith("linux")
Example #6
Source File: cbc.py From python-mip with Eclipse Public License 2.0 | 5 votes |
def write(self, file_path: str): fpstr = file_path.encode("utf-8") if ".mps" in file_path.lower(): cbclib.Cbc_writeMps(self._model, fpstr) elif ".lp" in file_path.lower(): cbclib.Cbc_writeLp(self._model, fpstr) else: raise ValueError( "Enter a valid extension (.lp or .mps) \ to indicate the file format" )