-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
__main__.py
31 lines (27 loc) · 1023 Bytes
/
__main__.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
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Kernels Contributors
#
# Licensed under the terms of the MIT License
# (see spyder_kernels/__init__.py for details)
# -----------------------------------------------------------------------------
import sys
import os
if __name__ == '__main__':
# Remove the current working directory from sys.path for Python 3.7+
# because since that version it's added by default to sys.path when
# using 'python -m'.
if sys.version_info[0] == 3 and sys.version_info[1] >= 7:
cwd = os.getcwd()
if cwd in sys.path:
sys.path.remove(cwd)
from spyder_kernels.console import start
try:
start.main()
except Exception:
# We have to explicitely write to __stderr__ as stderr might already
# have been replaced.
import traceback
traceback.print_exc(file=sys.__stderr__)
sys.__stderr__.flush()
raise