Let's say I have a module that cannot be imported (there is an exception when importing).
eg. test.py
with the following contents:
print 1/0
[Obviously, this is not my actual file, but it will stand like a good proxy]
Now at the python prompt:
>>> import test Traceback (most recent call last): File "<stdin>", line 1, in <module> File "test.py", line 1, in <module> print 1/0 ZeroDivisionError: integer division or modulo by zero >>>
What is the best way to find the location of the path / file of test.py
?
[I could scroll through the Python module search path by looking in each directory for the file, but I think there should be an easier way ...]
source share