Skip to content

Commit df491f9

Browse files
committed
fixed for virtualenvs
1 parent 8ac585d commit df491f9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/cs50/cs50.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from distutils.sysconfig import get_python_lib
88
from os.path import abspath, join
9-
from site import getusersitepackages
109
from termcolor import cprint
1110
from traceback import extract_tb, format_list, format_exception_only
1211

@@ -16,10 +15,9 @@ def excepthook(type, value, tb):
1615
Format traceback, darkening entries from global site-packages directories
1716
and user-specific site-packages directory.
1817
19-
https://stackoverflow.com/a/33042323/5156190
20-
https://stackoverflow.com/a/122340/5156190
18+
https://stackoverflow.com/a/46071447/5156190
2119
"""
22-
packages = tuple(join(abspath(p), "") for p in [get_python_lib(), getusersitepackages()])
20+
packages = tuple(join(abspath(p), "") for p in sys.path[1:])
2321
for entry in extract_tb(tb):
2422
fmt = format_list((entry,))
2523
if (entry[0].startswith(packages)):

0 commit comments

Comments
 (0)