user7073454 user7073454 - 7 months ago 32
Python Question

python -find which library is currently executed

I need to find out the path for a particular library in my script.

I tried using :


but it gives an attribute error:

"type object 'MODULE' has no attribute '__file__'."

Is there any other way to find the path for a particular module? I do not want to use
as it gives the list of all the libraries.


Actually my code was something like : from <module> import blah

I was trying to find the module path using : os.path.dirname(module.__file__) It gave an error saying "module" does not exist. So I did : import module and then from <module> import blah Then it worked !!