Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'subject:: [': 0.04; 'subject:file': 0.07; 'sys': 0.07; 'except:': 0.09; 'try:': 0.09; 'def': 0.12; 'handling:': 0.16; 'subject:] [': 0.16; 'exception': 0.16; 'trying': 0.19; 'skip:f 30': 0.19; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'test.': 0.24; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'correct': 0.29; "doesn't": 0.30; 'code': 0.31; 'keyerror:': 0.31; 'except': 0.35; 'test': 0.35; 'but': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'even': 0.60; 'simple': 0.61; 'confirm': 0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 28 Aug 2013 12:51:03 +0100 From: ishish To: Subject: Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of In-Reply-To: <73c7b08d-5349-49ba-b945-6d87795088bf@googlegroups.com> References: <39be9227-c800-49a5-850d-f387c30d1e9d@googlegroups.com> <73c7b08d-5349-49ba-b945-6d87795088bf@googlegroups.com> X-Sender: ishish@domhain.de User-Agent: RoundCube Webmail/0.7.1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377690664 news.xs4all.nl 16009 [2001:888:2000:d::a6]:54375 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53135 Am 28.08.2013 12:14, schrieb Ferrous Cranus: > Okey, continue trying and trying i came up with this: > > > try: > if os.path.exists( path + page ) or os.path.exists( cgi_path + page > ): > cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) > data = cur.fetchone() > except: > with open("err.out", "a") as f: > f.write( repr(query), type(query) ) > f.write( repr(escaped_args), type(escaped_args) ) > > > But i cannot test it without looking at the error log which is > scrolling like hell and doesn't even quit with a ctrl+c > > How will i manage to troubleshoot? > Please confirm the above is correct and is what you were propsoing i > shoudl test. A simple way I always use if it comes to exception handling: import sys import traceback # Exception Identification def formatExceptionInfo(maxTBlevel=5): cla, exc, trbk = sys.exc_info() excName = cla.__name__ try: excArgs = exc.__dict__["args"] except KeyError: excArgs = "" excTb = traceback.format_tb(trbk, maxTBlevel) return (excName, excArgs, excTb) try: # Your code except: print formatExceptionInfo()