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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:: [': 0.04; 'string': 0.09; 'cc:addr:python-list': 0.11; 'cases:': 0.16; 'exactly?': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'subject:] ': 0.20; 'seems': 0.21; 'command': 0.22; 'email addr:gmail.com>': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'subject:problem': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'errors': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'linux': 0.33; 'running': 0.33; 'subject:with': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'returning': 0.36; 'wrong': 0.37; 'received:209': 0.37; 'you.': 0.62; 'to:addr:gmail.com': 0.65; 'therefore': 0.72; '2013': 0.98 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:to :cc:content-type; bh=pz4L8VW1ZuaQOvsNgJ8a5ROu2XhR2jheO1I/56Z/1hQ=; b=dosKQRXF2cN8pHt7wbRZS6PZKQ6+YPG+H4fpvYJ2ADS2fO2LHKIk/+zBjlAzMxsDpo ffy3Yct3gEslYteBs64Rg7Vd7IUKpjfpscggRSGaLF9cT+pcrwjjgip1gW5wtrnIQkdj OzQxOREy/jTNolTM6CFXGWZU8YkRtepHXo+1d//diDfJJnlqJdJpu/MJGspTt5cFST4K 6cgcd+1G+XBmrS+3sYd1T12r+a7gCZH5A4d4zpO62AE2fJ7LpcV2Dc0vJ6bYCma9cyra lUlJvN/hRuwiMSeDAM6fkDSWaUyf4trn8RBK0/KvlAKeYpEVBS51WcvOV7TP+V80iMvP Cd+g== MIME-Version: 1.0 X-Received: by 10.49.107.2 with SMTP id gy2mr8178742qeb.21.1370808049480; Sun, 09 Jun 2013 13:00:49 -0700 (PDT) In-Reply-To: References: Date: Sun, 9 Jun 2013 21:00:49 +0100 Subject: Re: [newbie] problem with if then From: =?ISO-8859-1?Q?F=E1bio_Santos?= To: Jean Dubois Content-Type: multipart/alternative; boundary=047d7bdc13ced839e204debe1e19 Cc: python-list@python.org 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370808058 news.xs4all.nl 15990 [2001:888:2000:d::a6]:35039 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47485 --047d7bdc13ced839e204debe1e19 Content-Type: text/plain; charset=ISO-8859-1 On 9 Jun 2013 20:49, "Jean Dubois" wrote: > > I'm writing some code to check whether an url is available or not, > therefore I make use of a wget-command in Linux and then check whether > this is successful (returning a 0) or not returning an 8 > However the if then statement seems to give the same result in both > cases: Which result? Failure, or success? Have you tried printing the checkavailablestring string and running that command exactly? There may be something wrong with the command or URL in some way, and calling os.system instead of using the shell directly will hide any errors from you. --047d7bdc13ced839e204debe1e19 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On 9 Jun 2013 20:49, "Jean Dubois" <jeandubois314@gmail.com> wrote:
>
> I'm writing some code to check whether an url is available or not,=
> therefore I make use of a wget-command in Linux and then check whether=
> this is successful (returning a 0) or not returning an 8
> However the if then statement seems to give the same result in both > cases:

Which result? Failure, or success? Have you tried printing t= he checkavailablestring string and running that command exactly? There may = be something wrong with the command or URL in some way, and calling os.syst= em instead of using the shell directly will hide any errors from you.

--047d7bdc13ced839e204debe1e19--