-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshipnet.pyw
More file actions
35 lines (28 loc) · 934 Bytes
/
Copy pathshipnet.pyw
File metadata and controls
35 lines (28 loc) · 934 Bytes
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
#!/usr/bin/env python3
"""ShipNetMonitor — entry point.
Usage:
python shipnet.pyw # with console (for debugging)
pythonw shipnet.pyw # without console (production on Windows)
"""
import logging
import sys
import os
# Ensure src/ is importable regardless of cwd
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# When launched with pythonw (no console), sys.stdout/stderr are None.
# Redirect them to devnull so that print() / logging / libraries don't crash.
if sys.stdout is None:
sys.stdout = open(os.devnull, "w")
if sys.stderr is None:
sys.stderr = open(os.devnull, "w")
# Console logging — visible when launched with `python` (not pythonw)
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(name)s] %(message)s",
datefmt="%H:%M:%S",
stream=sys.stdout,
)
from src.app import App
if __name__ == "__main__":
app = App()
app.mainloop()