Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '16,': 0.03; 'stops': 0.07; 'subject:test': 0.07; 'cc:addr:python-list': 0.09; 'blocked': 0.09; 'spawn': 0.09; 'thread': 0.10; 'extensions': 0.13; 'wed,': 0.15; 'intermediate': 0.15; 'languages,': 0.15; 'thu,': 0.15; 'example)': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Problem': 0.16; 'subject:case': 0.16; 'subject:simple': 0.16; 'wrote:': 0.16; 'obviously': 0.16; 'frameworks': 0.18; 'stick': 0.18; 'test.': 0.18; '>>>': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'saying': 0.22; 'am,': 0.23; 'seems': 0.23; 'header:In-Reply- To:1': 0.24; "i've": 0.25; 'chris': 0.26; 'figure': 0.27; 'parameters': 0.27; 'message-id:@mail.gmail.com': 0.27; 'pieces': 0.27; 'values': 0.28; 'larry': 0.29; "i'm": 0.30; 'print': 0.30; 'server.': 0.30; 'code': 0.30; '15,': 0.30; 'another': 0.32; "can't": 0.32; 'point': 0.33; 'instead,': 0.33; 'server': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'on,': 0.35; 'jason': 0.35; 'something': 0.35; 'but': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'method': 0.37; 'doing': 0.38; 'several': 0.38; 'test': 0.39; "didn't": 0.39; 'subject:with': 0.40; 'still': 0.40; 'some': 0.40; 'press': 0.61; 'making': 0.62; 'places': 0.64; 'intent': 0.66; 'python-list': 0.66; 'here': 0.66; 'results': 0.66; 'cut': 0.67; 'subject:. ': 0.67; 'study': 0.70; 'jul': 0.72; 'yourself': 0.73; 'calculations': 0.84; 'chrisa': 0.84; 'commenting': 0.84; 'etc),': 0.84; 'out!': 0.84; 'trick,': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=eoGkqhTyEI8PB5LikmTJ2BX9o50AbnqSHzCzghw70e4=; b=bShxsKwmEZLVOA2NYFpw/hXpVL+X0fKx3ZOAamOuJuTEaAraNLODwGvLRVzOtg6jRX l9iginzuzKIOGBqXe7Ybaa0/KrJucddFY/zhEoy35bAlZjOIpsaZI1bnznvI8ab6c/ye Cv74G3k9u/V0huk1cFqe/sGNp69ZBvYwKcxi0s7JtOMchxTXqCwGif7goEtfHLyNsPsp pUMPxYLAALz6ssd8FjQCcjIJgh65qj9yKW3bhxZegRTZ93nir2GfLknZCjMBxJwV10EP 8eYs5a1yEUfahc4c3wqFcbLa2PdevoOTjgC2rB9JLJ15HDZk4l/GJTOcgCJzxw+8JIkv LAxw== MIME-Version: 1.0 X-Received: by 10.50.7.104 with SMTP id i8mr1537963iga.50.1437016288425; Wed, 15 Jul 2015 20:11:28 -0700 (PDT) In-Reply-To: <79mdneVqW9UGgzrInZ2dnUU7-cOdnZ2d@giganews.com> References: <0165e508-b3b4-4a95-b1bb-e115893056f8@googlegroups.com> <79mdneVqW9UGgzrInZ2dnUU7-cOdnZ2d@giganews.com> Date: Thu, 16 Jul 2015 13:11:28 +1000 Subject: Re: Noob in Python. Problem with fairly simple test case From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437016291 news.xs4all.nl 2828 [2001:888:2000:d::a6]:45369 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.91.MISMATCH!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:93891 On Thu, Jul 16, 2015 at 1:01 PM, Larry Hudson via Python-list wrote: > On 07/15/2015 05:11 AM, Chris Angelico wrote: >> >> On Wed, Jul 15, 2015 at 9:44 PM, Jason P. wrote: >>> >>> I can't understand very well what's happening. It seems that the main >>> thread gets blocked listening to the web server. My intent was to spawn >>> another process for the server independent of the test. Obviously I'm doing >>> something wrong. I've made several guesses commenting pieces of code >>> (tearDown method for example) but I didn't manage to solve the problem(s). >>> >> >> When you find yourself making guesses to try to figure out what's >> going on, here are two general tips: >> >> 1) Cut out as many pieces as you can. Test one small thing at a time. >> 2) If In Doubt, Print It Out! Stick print() calls into the code at key >> places, displaying the values of parameters or the results of >> intermediate calculations - or just saying "Hi, I'm still here and I'm >> running!". >> > In addition to using print(), in some places I like using input() instead, > as in: > input('x={}, y={} --> '.format(x, y)) > Then the program stops at that point so you can study it. > To continue just press , or Ctrl-C to abort. That's a neat trick, as long as you actually do have a console. IIDPIO is extremely general (works across languages, across frameworks (eg a web server), etc), but these kinds of extensions are pretty handy when they make sense. ChrisA