本文整理汇总了Python中util.Util.bail方法的典型用法代码示例。如果您正苦于以下问题:Python Util.bail方法的具体用法?Python Util.bail怎么用?Python Util.bail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.Util
的用法示例。
在下文中一共展示了Util.bail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_sys_dep
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import bail [as 别名]
def check_sys_dep():
for pkg, dists in sys_dep.items():
if dist in dists:
if not install_with_package_manager(dists[dist]):
Util.bail('Failed to install ' + pkg)
else:
Util.bail('Distribution ' + str(dist) +
' is not supported by this script')
示例2: main
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import bail [as 别名]
def main(args):
try:
books = Environment.get_books(args.root_dir, args, stage='process')
except Exception as e:
Util.bail(str(e))
P = ProcessHandling()
queue = P.new_queue()
for book in books:
queue.add(book, cls='FeatureDetection', mth='pipeline')
if args.derive_all or args.derive:
if args.derive:
formats = args.derive
else:
formats = ('djvu', 'pdf', 'epub', 'text')
if book.settings['respawn']:
queue.add(book, cls='Crop', mth='cropper_pipeline',
kwargs={'crop': 'standardCrop'})
queue.add(book, cls='OCR', mth='tesseract_hocr_pipeline',
kwargs={'lang': args.language})
if 'djvu' in formats:
queue.add(book, cls='Djvu', mth='make_djvu_with_c44')
if 'pdf' in formats:
queue.add(book, cls='PDF', mth='make_pdf_with_hocr2pdf')
if 'epub' in formats:
queue.add(book, cls='EPUB', mth='make_epub')
if 'text' in formats:
queue.add(book, cls='PlainText', mth='make_full_plain_text')
queue.drain('sync')
示例3: check_py_dep
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import bail [as 别名]
def check_py_dep():
for module, pkg in py_dep.items():
print ('Installing ' + module)
if not install_with_pip(pkg):
Util.bail('Failed to install ' + module)
示例4:
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import bail [as 别名]
import os, sys, platform
import glob
from urllib import request
import zipfile
import tarfile
import re
from util import Util
py_version = sys.version_info
if py_version[0] < 3:
Util.bail('Python 3+ required')
plat = sys.platform
if re.search('linux', plat):
dist = platform.linux_distribution()[0]
if re.search('darwin', plat):
dist = platform.mac_ver()[0]
if re.search('win', plat):
dist = platform.win32_ver()[0]
dist = dist.lower()
print ('Environment: ' + dist, plat)
py_dep = {'yaml': 'pyaml',
'lxml': 'lxml',
'psutil': 'psutil',
'PyPDF2': 'git+git://github.com/mstamy2/PyPDF2',
'PIL': 'pillow',
'xmltodict': 'xmltodict',