diff -r 2add671bf55b -r 5b0baa9f3362 mercurial/scmposix.py --- a/mercurial/scmposix.py Sun Nov 20 13:50:45 2016 -0800 +++ b/mercurial/scmposix.py Mon Nov 21 15:26:47 2016 +0530 @@ -9,6 +9,7 @@ from . import ( encoding, osutil, + pycompat, ) def _rcfiles(path): @@ -30,7 +31,7 @@ root = 'etc/mercurial' # old mod_python does not set sys.argv if len(getattr(sys, 'argv', [])) > 0: - p = os.path.dirname(os.path.dirname(sys.argv[0])) + p = os.path.dirname(os.path.dirname(pycompat.sysargv[0])) if p != '/': path.extend(_rcfiles(os.path.join(p, root))) path.extend(_rcfiles('/' + root))