Get module paths in python

Sometimes we may get unexpected results when importing modules in Python (Probably because we are doing something wrong). pprint is a great tool for those cases, it allow us to check the real path of the module we are trying to import:

import pprint, os
import my_module

pprint.pprint(os.path.abspath(my_module.__file__))

Leave a Reply

Your email address will not be published. Required fields are marked *