def open_gui_editor(filename):
"""Opens default GUI text editor."""
if sys.platform == "win32":
os.startfile(filename)
elif sys.platform.startswith("darwin"):
try:
subprocess.call(["open", filename])
except FileNotFoundError:
print("Your default editor \"{}\" could not be opened.")
print("You can manually open \"{}\" if you want to edit it.".format(filename))
elif sys.platform.startswith("linux"):
try:
subprocess.call(["xdg-open", filename])
except FileNotFoundError:
print("Your default editor \"{}\" could not be opened.")
print("You can manually open \"{}\" if you want to edit it.".format(filename))
else:
print("Could not determine text editor.")
print("You can manually open \"{}\" if you want to edit it.".format(filename))
评论列表
文章目录