Skip to content

Instantly share code, notes, and snippets.

Created May 9, 2016 21:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Display all python importable paths
import sys
import os
from colorama import init
from colorama import Fore, Back, Style
def testEquals(p,l):
for i in l:
if os.path.normpath(p) == os.path.normpath(i):
return True
return False
user_paths = os.environ['PYTHONPATH'].split(os.pathsep)
except KeyError:
user_paths = []
print(">> sys.path : all importable paths. " + Fore.GREEN + "(from PYTHONPATH)")
for p in sys.path:
p = os.path.normpath(p)
if testEquals(p,user_paths):
print(Fore.GREEN + p)
print(Fore.BLUE + p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment