本文整理匯總了Python中os.startfile方法的典型用法代碼示例。如果您正苦於以下問題:Python os.startfile方法的具體用法?Python os.startfile怎麽用?Python os.startfile使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在模塊os的用法示例。
在下文中一共展示了os.startfile方法的29個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1: shutdown
點讚 6
# 需要導入模塊: import os [as 別名]
# 或者: from os import startfile [as 別名]
def shutdown():
if lp_events.timer != None:
lp_events.timer.cancel()
scripts.to_run = []
for x in range(9):
for y in range(9):
if scripts.threads[x][y] != None:
scripts.threads[x][y].kill.set()
if window.lp_connected:
scripts.unbind_all()
lp_events.timer.cancel()
launchpad_connector.disconnect(lp)
window.lp_connected = False
logger.stop()
if window.restart:
if IS_EXE:
os.startfile(sys.argv[0])
else:
os.execv(sys.executable, ["\"" + sys.executable + "\""] + sys.argv)
sys.exit("[LPHK] Shutting down...")
開發者ID:nimaid,項目名稱:LPHK,代碼行數:22,
示例2: open_image
點讚 6
# 需要導入模塊: import os [as 別名]
# 或者: from os import startfile [as 別名]
def open_image(directory, image):
answer = input("Would you like to open the image of the computed passport file? [y] / n : ").lower()
if answer in ("y", "yes") or answer == "":
try:
# TODO: Test abspath() on Windows
image_path = os.path.join(os.pardir, os.pardir, "docs", "images", directory, image)
print(image_path)
if sys.platform.startswith('darwin'):
subprocess.call(('open', image_path))
elif os.name == 'nt':
os.startfile(image_path)
elif os.name == 'posix':
subprocess.call(('xdg-open', image_path))
except Exception:
print("%s- An unexpected error occurred. The file could not be opened%s" % RED)
for msg in sys.exc_info():
print("\033[31m!", str(msg))
elif answer in ("n", "no"):
exit()
else:
print("%sInvalid response%s" % RED)
open_image(directory, image)
開發者ID:Arg0s1080,項目名稱:mrz,代碼行數:27,
示例3: explore
點讚 6
# 需要導入模塊: import os [as 別名]
# 或者: from os import startfile [as 別名]
def explore(path):
if path:
if os.path.exists(path):
path = os.path.dirname(path)
platform = os_qeury()
if platform == "darwin":
subprocess.Popen(['open',path])
return True
elif platform == "win32":
os.startfile(path)
return True
log.info("File dose not exist")
return False
log.info("No file name spacified")
return False
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:20,
示例4: run
點讚 6
# 需要導入模塊: import os [as 別名]
# 或者: from os import startfile [as 別名]
def run(filename):
if filename:
if os.path.exists(filename):
if sys.platform == "win32":
os.startfile(filename)
return True
else:
opener ="open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, filename])
return True
log.info("File dose not exist")
return False
log.info("No file name spacified")
return False
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:18,
示例5: _create_image_from_map
點讚 6
# 需要導入模塊: import os [as 別名]
# 或者: from os import startfile [as 別名]
def _create_image_from_map(map_file, out_img, format):
out_img += ".%s" % format
#print out_img
params = ["shp2img", "-m", map_file, "-i", format, "-o", out_img]
os.environ['PATH'] = DLL_LOCATION + ';' + os.environ['PATH']
p = Popen(params, stdout=PIPE, bufsize=1)
with p.stdout:
for line in iter(p.stdout.readline, b''):
print(line)
p.wait() # wait for the subprocess to exit
#os.startfile(out_img)
return out_img
開發者ID:geographika,項目名稱:mappyfile,代碼行數:19,
示例6: create_image_from_map
點讚 6
# 需要導入模塊: import os [as 別名]
# 或者: from os import startfile [as 別名]
def create_image_from_map(map_file, dll_location):
of = tempfile.NamedTemporaryFile(delete=False, suffix=".png", prefix="tmp_")
of.close()
logging.debug("Creating file %s", of.name)
# [SHP2IMG] -m [MAPFILE] -i png -o [RESULT]
params = ["shp2img","-m", map_fil