A simple way to find out a Python module's location on your drive.
Get a Python module's location
''' module_origin1.py
Where does a given module come from?
You could use module.__path__
but not all modules have a .pth file
tested with Python27 and Python33 by vegaseat 22oct2013
'''
try:
# Python2
import Tkinter as tk
except ImportError:
# Python3
import tkinter as tk
import os
print(os.path.dirname(tk.__file__))
'''
result (Python27) ...
c:\python27\lib\lib-tk
result (Python33) ...
c:\python33\lib\tkinter
'''
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
Gribouillis 1,391 Programming Explorer Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.