On 04 avril 22:57, Alex Davies wrote: > Hi All, Hi, > If I run pylint as root (I know, I know), it fails to find my .pylintrc file: > > [root@a b]# strace pylint --report n c.py 2>&1 | grep pylintrc > stat("pylintrc", 0x7fff75600e30) = -1 ENOENT (No such file or > directory) > stat(".pylintrc", 0x7fff75600e30) = -1 ENOENT (No such file or > directory) > stat("/etc/pylintrc", 0x7fff75600e30) = -1 ENOENT (No such file or > directory) > > The cause seems to be in pylint/config.py (from latest tarball): > > 90 if 'PYLINTRC' in os.environ and exists(os.environ['PYLINTRC']): > 91 pylintrc = os.environ['PYLINTRC'] > 92 else: > 93 user_home = expanduser('~') > 94 if user_home == '~' or user_home == '/root': > 95 pylintrc = ".pylintrc" > 96 else: > 97 pylintrc = join(user_home, '.pylintrc') > > expanduser() will return a tilde in the case that expanduser isn’t > able to figure out what the home directory is, but I’m not really sure > why we want to set .pylintrc to be in the local directory in the case > that /root is returned; expand user works just fine: > > >>> from os.path import expanduser > >>> expanduser('~') > '/root' > > Can anyone shed light on this? There is probably a good reason why > that “/root” if block is there, which I would like to understand > before considering if a patch to remove it makes sense.
This has been there for a while (before migration to hg...). I'm fine to remove this particular case that I can't explain anymore. -- Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework: http://www.cubicweb.org _______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects