Fix uninstalled use with modules that change __file__
Some modules such as runpy (and by extension, modules such as trace that use runpy) alter the value of __file__, which causes our directory-location logic to fail. This patch tries to detect this by checking the value of __file__ and falling back to sys.argv when it looks to be dodgy. Based on a patch and suggestions from Peter Tyser.
Showing with 7 additions and 1 deletion