-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyzolauncher.py
executable file
·54 lines (38 loc) · 1.29 KB
/
pyzolauncher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2016, the Pyzo development team
#
# Pyzo is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" pyzolauncher.py script
This is a script used to startup Pyzo. Added for convenience, and also
for running a test on the source version.
Pyzo can be installed as a package, but it does not have to. You can
start Pyzo in a few different ways:
* execute this script (pyzolauncher.py)
* execute the pyzo directory (Python will seek out pyzo/__main__.py)
* execute the pyzo package ("python -m pyzo")
Only in the latter must Pyzo be installed.
"""
import os
import sys
import subprocess
# faulthandler helps debugging hard crashes, it is included in py3.3
try:
if sys.executable.lower().endswith("pythonw.exe"):
raise ImportError("Dont use faulthandler in pythonw.exe")
import faulthandler
faulthandler.enable()
except ImportError:
pass
if "--test" in sys.argv:
# Prepare log file
logfilename = os.path.abspath(os.path.join(__file__, "..", "log.txt"))
with open(logfilename, "wt") as f:
f.write("")
# Run Pyzo
os.environ["PYZO_LOG"] = logfilename
subprocess.run([sys.executable, "pyzo", "--test"])
else:
import pyzo
pyzo.start()