Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:166': 0.05; 'skip:/ 10': 0.07; 'before.': 0.09; 'errors,': 0.09; 'path.': 0.09; 'subject:modules': 0.09; 'such.': 0.09; 'term,': 0.09; 'uninstalled': 0.09; 'yet.': 0.13; '(the': 0.15; 'cases': 0.15; '.py': 0.16; 'confusion': 0.16; 'received:166.84': 0.16; 'received:166.84.1': 0.16; 'received:166.84.1.89': 0.16; 'received:mailbackend.panix.com': 0.16; 'received:panix.com': 0.16; 'reinstalled': 0.16; 'removed,': 0.16; 'roy': 0.16; 'sorts': 0.16; 'sys.path': 0.16; 'wanted)': 0.16; 'deployment': 0.17; 'module': 0.19; 'deployed': 0.22; 'matching': 0.23; '---': 0.26; 'appear': 0.26; '(such': 0.27; 'about.': 0.29; 'behind.': 0.29; 'finds': 0.29; "i'm": 0.29; "we're": 0.30; 'code': 0.31; 'to:addr :python-list': 0.33; '(with': 0.33; 'skip:- 20': 0.34; 'adds': 0.35; 'something': 0.35; 'there': 0.35; 'tool': 0.36; 'but': 0.36; 'modules': 0.36; "didn't": 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'files': 0.38; 'some': 0.38; 'sure': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'your': 0.60; 'stay': 0.61; 'header:Message-Id:1': 0.62; 'invest': 0.62; 'situation': 0.62; 'ever': 0.63; 'times': 0.63; 'more': 0.63; 'our': 0.65; 'lack': 0.71; 'smith': 0.71; 'confusing': 0.84; 'email addr:panix.com': 0.84; 'mistakes.': 0.84; 'tree,': 0.84 From: Roy Smith Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Thu, 23 Aug 2012 11:30:05 -0400 Subject: Looking for duplicate modules To: python-list@python.org Mime-Version: 1.0 (Apple Message framework v1278) X-Mailer: Apple Mail (2.1278) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345735814 news.xs4all.nl 6882 [2001:888:2000:d::a6]:55292 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27742 We got burned yesterday by a scenario which has burned us before. We = had multiple copies of a module in sys.path. One (the one we wanted) = was in our deployed code tree, the other was in /usr/local/lib/python/ = or some such. It was a particularly confusing situation because we = *knew* we had uninstalled the copy in /usr/local/lib. What we didn't = know was that puppet was set up to check to make sure it was there and = reinstalled it automagically if it ever disappeared! What often adds to the confusion in cases like this is that if you use a = package manager (such as apt-get) to manage your module deployments, = when you uninstall, the .py files get removed, but the .pyc's stay = behind. I'm working on a tool which scans all the directories in sys.path and = finds any modules which appear multiple times in the path. It'll also = call out any .pyc's it finds without matching py's. I know those are not strictly errors, but both of them are, for lack of = a better term, "deployment smells" and something to be warned about. = Before I invest too much effort into building it, does such a tool = already exist? We're slowly moving more of our deployment to using virtualenv (with = --no-site-packages), but we're not fully there yet. And even when we = get there, there will still be opportunities to make these sorts of = mistakes. --- Roy Smith roy@panix.com