本文整理汇总了Python中sys.exist函数的典型用法代码示例。如果您正苦于以下问题:Python exist函数的具体用法?Python exist怎么用?Python exist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exist函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: install_zookeeper
def install_zookeeper():
# /mnt/zookeeper/data chown
config = json.load(open('zookeeper-config.json'));
data_dir_maked = subprocess.check_call(["sudo", "mkdir", "-p", "/mnt/zookeeper/data"])
if 0 == data_dir_maked:
subprocess.call(["sudo", "chown", "-R", "cloud-user", "/mnt/zookeeper"])
else:
print("Create dirctory /mnt/zookeeper/data failed")
sys.exist(1)
print("Create dirctory /mnt/zookeeper/data successfully")
# myid
myip = get_ip_address()
mynode = [node for node in config['nodes'] if node['ip'] == myip][0]
open("/mnt/zookeeper/data/myid", "w").write(str(mynode['id']))
print("Set myid for zookeeper successfully")
# cp zookeeper
subprocess.call(['sudo', 'rm', '-rf', '/usr/local/zookeeper'])
subprocess.call(['sudo', 'cp', '-r', './zookeeper', '/usr/local/zookeeper'])
for node in config['nodes']:
appendline('/usr/local/zookeeper/conf/zoo.cfg', 'server.'+str(node['id'])+'=zoo'+str(node['id'])+':2888:3888')
subprocess.call(['sudo', 'chown', '-R', 'cloud-user', '/usr/local/zookeeper'])
# hosts
for node in config['nodes']:
appendline('/etc/hosts', node['ip']+'\t'+'zoo'+str(node['id']))
开发者ID:sesteves,项目名称:StreamBench,代码行数:25,代码来源:installlib.py
示例2: main
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "i:", ["input="])
except getopt.GetoptError:
usage()
sys.exit(2)
f = None
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exist(2)
elif opt in ("-i", "--input"):
try:
f = open(arg, 'r')
except (OSError, IOError) as e:
usage()
sys.exit(2)
p = parser.Parser()
ast = p.parse(f.read())
if ast == None:
print "ERROR! The file " + arg + " is not valid"
else:
print "AST was successfully built. Generating Finite Automata..."
a = convert(ast)
a.toHTML()
print "FiniteAutomata.html was successfully generated! :)"
开发者ID:leonardolima,项目名称:jflap-check,代码行数:29,代码来源:FiniteAutomaton.py
示例3: get_topicMatrix
def get_topicMatrix(Matrix, topicNum, fill = True):
h,w = Matrix.shape
if(True==fill):
add = float(np.sum(Matrix))/(h*w)
tmp = np.zeros((h,w), dtype=np.float32)
for i in range(h):
for j in range(w):
if(0==Matrix[i][j]):
tmp[i][j] += add
else:
tmp[i][j] += float(Matrix[i][j])
Matrix = tmp
m = min(h,w)
if (m<topicNum):
print "topicNum is large than the minor dimension of the Matrix!"
sys.exist()
u,s,v = np.linalg.svd(Matrix)
l = len(s)
sm = np.zeros((l,l))
for i in range(topicNum):
sm[i][i] = s[i]
if(h<w):
Matrix2 = (u.dot(sm)).dot(v[0:h,0:w])
else:
Matrix2 = (u[0:h,0:w].dot(sm)).dot(v)
return Matrix2
开发者ID:Huarong,项目名称:people_clustering,代码行数:28,代码来源:svd.py
示例4: set_array_frec
def set_array_frec():
client = PySimpleClient()
master = client.getComponent("CONTROL/MASTER")
arrayList = master.getAutomaticArrayComponents() + master.getManualArrayComponents()
for array in arrayList:
master.destroyArray(array.ComponentName)
arrayList = []
antennas = master.getAvailableAntennas()
master.createManualArray(antennas)
arrayList = master.getAutomaticArrayComponents() + master.getManualArrayComponents()
if ( arrayList != 1 ):
if( len(arrayList) == 0):
print "Could not create an array!!"
client.releaseComponent("CONTROL/MASTER")
sys.exit(0)
else:
print "Could not destroy previosly arrays and create a new fresh array!"
client.releaseComponent("CONTROL/MASTER")
sys.exist(0)
currentArray = client.getComponent(arrayList[0].ComponentName)
client.releaseComponent("CONTROL/MASTER")
setArrayName(currentArray.getArrayName())
array = getArray()
tp = array.getTotalPowerObservingMode()
return tp
开发者ID:normansaez,项目名称:scripts,代码行数:25,代码来源:array_frec_test.py
示例5: check_hosts_file
def check_hosts_file():
# Get the additional argumants. It might have been stored there.
global extra_args
# The argument for the hosts file.
hosts_path_arg = '-i'
# The current dir path the hosts file.
cur_path_hosts = os.getcwd() + '/hosts'
# Check if the hosts file argument was specified in command line.
if hosts_path_arg in extra_args:
# Make sure the file path is passed in.
arg_hosts_path_id = extra_args.index(hosts_path_arg) + 1
if extra_args[arg_hosts_path_id] == None:
sys.exist(errors('HOSTS_PATH_DECLARATION'))
# Return the path passed.
return extra_args[arg_hosts_path_id]
# If the hosts file exists in the local directory.
elif os.path.isfile(cur_path_hosts):
extra_args += [hosts_path_arg, cur_path_hosts]
return cur_path_hosts
# If none was passed and there isn't one in the current directory.
else:
return None
开发者ID:batandwa,项目名称:ap-lib,代码行数:29,代码来源:aplib.py
示例6: read_config
def read_config(config_file):
"""
Read configuration YAML file.
account and password keys are required in the file.
"""
config = yaml.load(open(config_file).read())
not_exist = [setting for setting in ("account", "password") if not config.has_key(setting)]
if not_exist:
print "Could not read %s setting from configration file." % ", ".not_exist
sys.exist(1)
return config
开发者ID:tfmagician,项目名称:gmail,代码行数:13,代码来源:gmail.py
示例7: xAxisTs
def xAxisTs(timeseries):
""" Prompt the user to choose a x-axis representation for the timeseries.
Args:
timeseries: a timeseries object
Returns:
x_axis - the values for the x-axis representation, \n
label - returns either "age", "year", or "depth"
"""
if "depth" in timeseries.keys() and "age" in timeseries.keys() or\
"depth" in timeseries.keys() and "year" in timeseries.keys():
print("Do you want to use time or depth?")
choice = int(input("Enter 0 for time and 1 for depth: "))
if choice == 0:
if "age" in timeseries.keys() and "year" in timeseries.keys():
print("Do you want to use age or year?")
choice2 = int(input("Enter 0 for age and 1 for year: "))
if choice2 == 0:
x_axis = timeseries["age"]
label = "age"
elif choice2 == 1:
x_axis = timeseries["year"]
label = "year"
else:
sys.exit("Enter 0 or 1")
elif "age" in timeseries.keys():
x_axis = timeseries["age"]
label = "age"
elif "year" in timeseries.keys():
x_axis = timeseries["year"]
label = "year"
elif choice == 1:
x_axis = timeseries["depth"]
label = "depth"
else:
sys.exit("Enter 0 or 1")
elif "depth" in timeseries.keys():
x_axis = timeseries["depth"]
label = "depth"
elif "age" in timeseries.keys():
x_axis = timeseries["age"]
label = "age"
elif "year" in timeseries.keys():
x_axis = timeseries["year"]
label = "year"
else:
sys.exist("No age or depth information available")
return x_axis, label
开发者ID:LinkedEarth,项目名称:Pyleoclim_util,代码行数:51,代码来源:LipdUtils.py
示例8: unzipFile
def unzipFile(filename):
"""
Unzips the file containing translations.
Returns name of the directory where files were extracted.
"""
try:
file = ZipFile(filename)
file.extractall(EXTRACTION_DIR)
except zipfile.BadZipFile as e:
print("Error while unzipping: {0}".format(e.strerror))
sys.exist(2)
except zipfile.LargeZipFile as e:
print("Error while unzipping: {0}".format(e.strerror))
sys.exist(2)
return EXTRACTION_DIR
开发者ID:Elf94,项目名称:bemyeyes-ios,代码行数:15,代码来源:update_translations.py
示例9: jksToBks
def jksToBks(source, target):
cmd = (
"keytool -importkeystore -srckeystore "
+ source
+ " -destkeystore "
+ target
+ " -srcstoretype JKS -deststoretype BKS "
+ "-srcstorepass password -deststorepass password -provider org.bouncycastle.jce.provider.BouncyCastleProvider -noprompt"
)
if debug:
print("[debug]", cmd)
p = subprocess.Popen(
cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=0
)
while True:
line = p.stdout.readline()
if p.poll() is not None and not line:
# The process terminated
break
sys.stdout.write(line)
if line.find("java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider") != -1:
print("")
print("WARNING: BouncyCastleProvider not found cannot export certificates for android demos in BKS format.")
print(
" You can download BKS provider from http://www.bouncycastle.org/download/bcprov-jdk15on-146.jar."
)
print(" After download copy the JAR to $JAVA_HOME/lib/ext where JAVA_HOME points to your JRE")
print(" and run this script again.")
print("")
sys.exit(1)
elif line.find("java.security.InvalidKeyException: Illegal key size") != -1:
print("")
print("WARNING: You need to install Java Cryptography Extension (JCE) Unlimited Strength.")
print(" You can download it from Additional Resources section in Orcale Java Download page at:")
print(" http://www.oracle.com/technetwork/java/javase/downloads/index.html.")
print("")
sys.exit(1)
if p.poll() != 0:
sys.exist(1)
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:45,代码来源:makecerts.py
示例10: process_one_project
def process_one_project(self, process_num, proj_path, FILE_tokens_file, db):
self.process_logging.info('Starting %s project <%s> (process %s)' % (self.PROJECTS_CONFIGURATION,proj_path,str(process_num)) )
p_start = dt.datetime.now()
if self.PROJECTS_CONFIGURATION == 'Leidos':
if not os.path.isdir(proj_path):
self.process_logging.warning('Unable to open %s project <%s> (process %s)' % (self.PROJECTS_CONFIGURATION,proj_path,str(process_num)))
else:
# Search for tar files with _code in them
tar_files = [os.path.join(proj_path, f) for f in os.listdir(proj_path) if os.path.isfile(os.path.join(proj_path, f))]
tar_files = [f for f in tar_files if '_code' in f]
if(len(tar_files) != 1):
self.process_logging.warning('Tar not found on <'+proj_path+'> (process '+str(process_num)+')')
else:
proj_id = db.insert_project(proj_path,None)
tar_file = tar_files[0]
times = self.process_tgz_ball(process_num, tar_file, proj_path, proj_id, FILE_tokens_file, db)
zip_time, file_time, string_time, tokens_time, write_time, hash_time, regex_time = times
p_elapsed = dt.datetime.now() - p_start
self.process_logging.info('Project finished <%s,%s> (process %s)', proj_id, proj_path, process_num)
self.process_logging.info('Process (%s): Total: %smicros | Zip: %s Read: %s Separators: %smicros Tokens: %smicros Write: %smicros Hash: %s regex: %s',
process_num, p_elapsed, zip_time, file_time, string_time, tokens_time, write_time, hash_time, regex_time)
else:
if self.PROJECTS_CONFIGURATION == 'GithubZIP':
if not zipfile.is_zipfile(proj_path):
self.process_logging.warning('Unable to open %s project <%s> (process %s)' % (self.PROJECTS_CONFIGURATION,proj_path,str(process_num)))
else:
proj_id = db.insert_project(proj_path,None)
times = self.process_zip_ball(process_num, proj_path, proj_id, FILE_tokens_file, db)
zip_time, file_time, string_time, tokens_time, write_time, hash_time, regex_time = times
p_elapsed = dt.datetime.now() - p_start
self.process_logging.info('Project finished <%s,%s> (process %s)', proj_id, proj_path, process_num)
self.process_logging.info('Process (%s): Total: %smicros | Zip: %s Read: %s Separators: %smicros Tokens: %smicros Write: %smicros Hash: %s regex: %s',
process_num, p_elapsed, zip_time, file_time, string_time, tokens_time, write_time, hash_time, regex_time)
else:
self.process_logging.error('Unknown project configuration format:%s' % (self.PROJECTS_CONFIGURATION))
sys.exist(1)
开发者ID:Mondego,项目名称:SourcererCC,代码行数:43,代码来源:tokenizer.py
示例11: transform_data_lbl
def transform_data_lbl(prj_dh,transform_type,
type_form='aas',data_lbl_col='NiA_norm',):
"""
Transforamtion of counts of mutants in data_lbl table
:param prj_dh: path to the project directory
:param transform_type: type of transformation log, plog, glog etc
:returns data_lbl: data_lbl with transformed counts
"""
data_lbl_fhs=glob("%s/data_lbl/aas/*" % prj_dh)
if len(data_lbl_fhs)>0:
col_sep="."
data_lbl_all=fhs2data_combo(data_lbl_fhs,cols=[data_lbl_col],index='mutids',col_sep=col_sep)
data_lbl_all_dh='%s/data_lbl/%s_all' % (prj_dh,type_form)
if not exists(data_lbl_all_dh):
makedirs(data_lbl_all_dh)
data_lbl_all_fh='%s/%s.csv' % (data_lbl_all_dh,data_lbl_col)
data_lbl_all.to_csv(data_lbl_all_fh)
if (transform_type=='log2') or (transform_type=='log'):
data_lbl_all=data_lbl_all.apply(np.log2)
elif transform_type=='plog':
data_lbl_all=data_lbl_all.apply(plog)
else:
logging.error("trnaform_type not valid: %s" % transform_type)
sys.exist()
data_lbl_col='NiA_tran'
data_lbl_all_fh='%s/%s.csv' % (data_lbl_all_dh,data_lbl_col)
data_lbl_all.to_csv(data_lbl_all_fh)
for col in data_lbl_all:
data_lbl_fn,tmp=col.split('.')
data_lbl_fh='%s/data_lbl/%s/%s' % (prj_dh,type_form,data_lbl_fn)
data_lbl=pd.read_csv(data_lbl_fh).set_index('mutids')
if not data_lbl_col in data_lbl:
data_lbl_cols=data_lbl.columns.tolist()
data_lbl=pd.concat([data_lbl,
data_lbl_all.loc[:,col]],axis=1)
data_lbl.columns=data_lbl_cols+[data_lbl_col]
data_lbl.index.name='mutids'
data_lbl.to_csv(data_lbl_fh)
开发者ID:kc-lab,项目名称:dms2dfe,代码行数:42,代码来源:io_mut_files.py
示例12: checkin_txt_to_db
def checkin_txt_to_db(words):
global conn
c = conn.cursor()
u_id = words[0]
tweet_id = words[1]
latitude = words[2]
longitude = words[3]
createdat = words[4]
if len(words) == 7:
text = unicode(words[5], encoding='UTF-8')
place_id = unicode(words[6], encoding='UTF-8')
if len(words) == 6:
print 6, words
sys.exist()
raise Exception("input words should be 4 length")
sql = sql_insert_words_checkin
c.execute(sql, (u_id, tweet_id, latitude, longitude, createdat, text, place_id, ))
#print words
conn.commit()
c.close()
开发者ID:jianhuashao,项目名称:PhDTwFin,代码行数:20,代码来源:db_util.py
示例13: main
def main():
parser = ArgumentParser(description='Effective Reader')
parser.add_argument(
'-c', '--config', help="Reader config file",
default=DEFAULT_CONFIG_PATH)
parser.add_argument(
'urls', metavar='URL', type=str, nargs='+',
help="Urls for read")
parser.add_argument(
'-v', '--verbosity', choices=VERBOSITY_CHOICES,
help="Verbose level", default=None)
parser.add_argument(
'-s', '--short', action='store_true',
help="Short view")
args = parser.parse_args()
log = get_logger('ereader', args.verbosity)
if not os.path.isfile(args.config):
log.error("Config file not found")
sys.exist(1)
config = ConfigParser()
readed = config.read([os.path.expanduser('~/.ereader.ini'), args.config])
log.debug('Read configs: %s', ', '.join(readed))
if args.verbosity is not None:
config.set('main', 'verbosity', str(args.verbosity))
if args.short is not None:
config.set('main', 'short', str(args.short))
app = EReaderApplication(config)
try:
app.configure(args.config)
app.run(args.urls)
except AssertionError as e:
log.warning(e)
except ConfigureError as e:
log.error('Configure error: %s', e)
sys.exit(1)
开发者ID:SowingSadness,项目名称:ereader,代码行数:41,代码来源:runner.py
示例14: main
def main(argv):
input_file = ""
is_shown = True
is_written = False
log_file = "profile_parser.log"
try:
opts, args = getopt.getopt(argv, "hqi:o:", ["help"])
except getopt.GetoptError:
print "The given arguments incorrect"
sys.exist(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
print ("----------------------")
print ("Usage: python profile_parser.py")
print ("")
print ("\t-h, --help: show the usage")
print ("\t-q: quiet mode")
print ("\t-i ...: input profile")
print ("\t-o ...: output profile")
print ("----------------------")
sys.exit()
elif opt in ("-i"):
input_file = arg
elif opt in ("-o"):
output_file = arg
is_written = True
elif opt in ("-q"):
is_shown = False
else:
print "The given arguments incorrect"
sys.exit(2)
if not os.path.exists(input_file):
print ("The input-file: %s doesn't exist" % input_file)
# parsing the profile
try:
with codecs.open(input_file, "r", "big5") as F:
header = F.readline().strip()
if header != "#/obj/user.c":
if is_shown:
print ("(header error) The input format incorrect")
print ("header: %s" % header)
with open(log_file, "a") as W:
W.write("%s header_incorrect\n" % input_file)
sys.exit(2)
for line in F:
line_tokens = line.strip().split(" ")
if line_tokens[0] == "idata":
# check if the number of line tokens is 2
if len(line_tokens) != 2:
merged_line_tokens = " ".join(line_tokens[1:])
q_patterns = '\"[^\"]*\"'
q_replacing_token = "KAEQTOKEN"
replaced_tokens = re.findall(q_patterns, merged_line_tokens)
data_field = re.sub(q_patterns, q_replacing_token, " ".join(line_tokens[1:]))
else:
data_field = line_tokens[1]
if is_shown:
print ("idata data-field: %s" % data_field)
b_patterns = '\(\{[^\)\}]*\}\)'
b_replacing_token = "KAEBTOKEN"
q_patterns = '\"[^\"]*\"'
q_replacing_token = "KAEQTOKEN"
data_field = re.sub('^\(\{', '', data_field)
data_field = re.sub('\}\)$', '', data_field)
merged_data_field = re.sub(b_patterns, b_replacing_token, data_field)
q_replaced_tokens = re.findall(q_patterns, merged_data_field)
merged_data_field = re.sub(q_patterns, q_replacing_token, merged_data_field)
data_tokens = merged_data_field.split(',')
if is_shown:
print ("")
print ("q_replaced_tokens")
print (",".join(q_replaced_tokens))
print ("")
print ("idata data-tokens:\n%s" % merged_data_field)
print ("idata data-token number: %d" % len(data_tokens))
def qtoken_recovery(index):
qIndex = len(filter(lambda x: x == q_replacing_token, data_tokens[:index]))
try:
return (q_replaced_tokens[qIndex])
except IndexError:
with open(log_file, "a") as W:
W.write("%s qRecovery_incorrect" % input_file)
data_token_number = 62
if len(data_tokens) == data_token_number:
# fetching the profile info.
char_id = data_tokens[0]
if char_id == q_replacing_token:
char_id = qtoken_recovery(0)
char_level = data_tokens[5]
char_race = data_tokens[33]
#.........这里部分代码省略.........
开发者ID:kaeaura,项目名称:churn_prediction_proj,代码行数:101,代码来源:profile_parser.py
示例15: add
if not os.path.exists(addressfile):
"""check if there exist the addressBook file"""
print 'The addressBook now is uncreated\n\
please add the new contract person first.\n\
Do you want to add(press "y") person or exit(press "n" or any other chars):'
choose = raw_input()
if choose == "y":
pA = info_input()
flag = pA.add_person(addressdict)
write_address(addressfile, addressdict)
if flag != False:
print "addressBook created successfully."
else:
print "Jesus"
sys.exist(1)
while True:
print "please assign the argument you want to operate,\nor you can use --help(--h) for help:"
option = raw_input()
if option.startswith("--"):
option = option[2:]
addressdict = read_address(addressfile)
elif option == "":
continue
else:
print "error: argument invalid synax,you can use --help(--h) to get more infomation"
continue
if option == "help" or option == "h":
print helpinfo
开发者ID:bobby-chiu,项目名称:python,代码行数:31,代码来源:run_addressbook.py
示例16: print
time.sleep(2)
# print(i, '/',par,con.get_rect_text(24,2,24,60))
# Get file ID
con.wait_for_text('Forwarding',4,20)
fileID = con.get_rect_text(24,2,24,60)
fileID = re.findall('INVSTAT123\s+in\s+(\w+)\s+was',fileID)
if len(fileID) > 0:
downloadId = fileID[0]
else:
# msgbox('Query Failed.\n Please run again')
pass
print(i+1,"/",par," --> ",downloadId)
if downloadId == None:
# msgbox('Daybookf report not Generated Please run it again')
sys.exist()
# Download file from IBM iSeries
path1 = cwd+'\\Full Invstat Archive\\'
ip='10.235.108.20'
uid= userOFS
pwd= passOFS
path=path1+"Archive\\"+"Part Range Invstat "+nameDate+'.xls'
fname= downloadId +'/'+'INVSTAT123('+uid.upper()+')'
std = datetime.datetime.now()
iseries.iSeries_download(ip, uid, pwd, fname, path)
etd = datetime.datetime.now()
ttstd = (etd - std).total_seconds()
print(i+1,"/",par,' Full Invstat Report Downloaded in : ',str(ttstd) ,'\n',path)
# time.sleep(5)
time.sleep(60)
开发者ID:vijaykumarmane,项目名称:Python-And-Pandas,代码行数:31,代码来源:Reporting+Using+Excel+Files+and+Functions.py
示例17: install
def install(app, args, env):
if len(sys.argv) < 3:
help_file = os.path.join(env["basedir"], 'documentation/commands/cmd-install.txt')
print open(help_file, 'r').read()
sys.exit(0)
name = cmd = sys.argv[2]
groups = re.match(r'^([a-zA-Z0-9]+)([-](.*))?$', name)
module = groups.group(1)
version = groups.group(3)
modules_list = load_module_list()
fetch = None
for mod in modules_list:
if mod['name'] == module:
for v in mod['versions']:
if version == None and v['isDefault']:
print '~ Will install %s-%s' % (module, v['version'])
print '~ This module is compatible with: %s' % v['matches']
ok = raw_input('~ Do you want to install this version (y/n)? ')
if not ok == 'y':
print '~'
sys.exit(-1)
print '~ Installing module %s-%s...' % (module, v['version'])
fetch = '%s/modules/%s-%s.zip' % (mod['server'], module, v['version'])
break
if version == v['version']:
print '~ Will install %s-%s' % (module, v['version'])
print '~ This module is compatible with: %s' % v['matches']
ok = raw_input('~ Do you want to install this version (y/n)? ')
if not ok == 'y':
print '~'
sys.exit(-1)
print '~ Installing module %s-%s...' % (module, v['version'])
fetch = '%s/modules/%s-%s.zip' % (mod['server'], module, v['version'])
break
if fetch == None:
print '~ No module found \'%s\'' % name
print '~ Try play list-modules to get the modules list'
print '~'
sys.exit(-1)
archive = os.path.join(env["basedir"], 'modules/%s-%s.zip' % (module, v['version']))
if os.path.exists(archive):
os.remove(archive)
print '~'
print '~ Fetching %s' % fetch
Downloader().retrieve(fetch, archive)
if not os.path.exists(archive):
print '~ Oops, file does not exist'
print '~'
sys.exist(-1)
print '~ Unzipping...'
if os.path.exists(os.path.join(env["basedir"], 'modules/%s-%s' % (module, v['version']))):
shutil.rmtree(os.path.join(env["basedir"], 'modules/%s-%s' % (module, v['version'])))
os.mkdir(os.path.join(env["basedir"], 'modules/%s-%s' % (module, v['version'])))
Unzip().extract(archive, os.path.join(env["basedir"], 'modules/%s-%s' % (module, v['version'])))
os.remove(archive)
print '~'
print '~ Module %s-%s is installed!' % (module, v['version'])
print '~ You can now use it by add adding this line to application.conf file:'
print '~'
print '~ module.%s=${play.path}/modules/%s-%s' % (module, module, v['version'])
print '~'
sys.exit(0)
开发者ID:Vitaliya,项目名称:java_mvc,代码行数:73,代码来源:modulesrepo.py
示例18: len
import sys
if len(sys.argv) != 4:
sys.exit ("Solo acepto 3 paramentros")
#_, operador, operando1, operando2 = sys.argv
operador = sys.argv[1]
operando1 = sys.argv[2]
operando2 = sys.argv[3]
operadores = ["suma", "resta", "multi", "div"]
if operador not in operadores:
sys.exist ("Solo acepto s r m d")
try:
operando1 = int(operando1)
operando2 = float(operando2)
except ValueError:
sys.exit("Dame un numero")
if operador == "suma":
print operando1 + operando2
if operador == "resta":
print operando1 - operando2
if operador == "multi":
print operando1 * operando2
开发者ID:LauraSR,项目名称:X-Serv-13.6-Calculadora,代码行数:30,代码来源:calculadora.py
示例19: uninstall_cyclus
def uninstall_cyclus(args):
makefile = os.path.join(args.build_dir, 'Makefile')
if not os.path.exists(args.build_dir) or not os.path.exists(makefile):
sys.exist("May not uninstall Cyclus since it has not yet been built.")
rtn = subprocess.check_call(['make', 'uninstall'], cwd=args.build_dir,
shell=(os.name == 'nt'))
开发者ID:alexravitz,项目名称:cyclus,代码行数:6,代码来源:install.py
示例20: DaemonThreadRunner
t = DaemonThreadRunner(cloud_sync, settings['PID_FILE'])
t.start()
del t
else:
try:
cloud_sync.setDaemon(True)
cloud_sync.start()
while cloud_sync.isAlive():
cloud_sync.join(1)
except KeyboardInterrupt:
print '\n! Received keyboard interrupt, quitting cloud sync threads.\n'
sys.exit()
if __name__ == '__main__':
if len(sys.argv) < 2:
sys.exist(2)
if not os.path.exists(sys.argv[1]):
print 'Cloud Sync configuration file [%s] not exists.' % sys.argv[1]
sys.exist(2)
if 'DJANGO_SETTINGS_MODULE' not in os.environ:
os.environ['DJANGO_SETTINGS_MODULE'] = 'cloud_sync_app.django_storage_module'
conf = open(sys.argv[1])
settings = yaml.load(conf)
conf.close()
from django.conf import settings as django_settings
setattr(django_settings, 'OSS_ACCESS_URL', settings['OSS_ACCESS_URL'])
if not settings['RESTART_AFTER_UNHANDLED_EXCEPTION']:
开发者ID:cogenda,项目名称:cloud-sync,代码行数:31,代码来源:cloud_sync.py
注:本文中的sys.exist函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论