Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Antoon Pardon Newsgroups: comp.lang.python Subject: Re: ftplib throws: IndexError: tuple index out of range Date: Sun, 14 Feb 2016 19:23:57 +0100 Lines: 33 Message-ID: References: <56C05CEF.5080304@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 2Q0hQXtyat6COEhhSnLHbwBNV/3blDAr3OgC7ZRfkSqw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; '__name__': 0.07; 'def': 0.13; "'__main__':": 0.16; 'received:adsl-dyn.isp.belgacom.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'trap': 0.16; 'exceptions': 0.22; 'produces': 0.22; 'variables.': 0.22; 'this:': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'module.': 0.27; 'looks': 0.29; 'received:192.168.1.3': 0.29; 'url:activestate': 0.29; 'received:be': 0.30; 'run': 0.33; 'url:code': 0.34; 'instead': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'turned': 0.38; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'charset:windows-1252': 0.62; 'more': 0.63; 'liking': 0.84; 'received:195.238': 0.84; 'schreef': 0.84; 'url:recipes': 0.84 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DgAACHxcBW/1KZhG0NUYQMbrJ1hyABDYFnI4VqAoFVFAEBAQEBAQGFTAEBAwF4EQshFg8JAwIBAgFFEwgCiA4WrFKKeoQKAQEIAgEdhhGENYR+g24FlnmBO4QUiAaCJoxOjj4eAQGCRBmBSYk/AQEB User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102920 Op 14-02-16 om 14:40 schreef Peter Otten: > > PS: How did you produce the overview over the local variables? That looks > nice. > I started from this recipe: http://code.activestate.com/recipes/52215-get-more-information-from-tracebacks/ made it more to my liking and turned it into a module. So that instead of a program being run like this: def program(argv): ... if __name__ == '__main__': program(sys.argv) I start it now like this from pymain import main def program(argv): ... if __name__ == '__main__': main(program) pymain.main will then trap almost all exceptions and produces the overview over the local variables. -- Antoon.