Re: problem with if then

2013-06-10 Thread Jean Dubois
On 9 jun, 23:35, Roy Smith wrote: > In article > <20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com>, >  Jean Dubois wrote: > > > But, really, > > > once you've done all that (and it's worth doing as an exercise), rewrite > > > your code to use urllib2 or requests.  It'll be a lot

Re: problem with if then

2013-06-09 Thread Roy Smith
In article <20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com>, Jean Dubois wrote: > But, really, > > once you've done all that (and it's worth doing as an exercise), rewrite > > your code to use urllib2 or requests.  It'll be a lot easier. > > Could you show me how to code the

Re: problem with if then

2013-06-09 Thread Jean Dubois
On 9 jun, 22:23, Roy Smith wrote: > In article > , >  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 > > In general, "shelling out" to run a command-line

Re: problem with if then

2013-06-09 Thread Jean Dubois
On 9 jun, 22:29, Fábio Santos wrote: > On 9 Jun 2013 21:24, "Jean Dubois" > ...> And here is the result: > > > jean@antec4:~$ ./try.py > > wget -q -O - > > http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/E...> > >/dev/null ; echo $? > > 8 > > 2013-06-07 22:07:00.016807 stream

Re: [newbie] problem with if then

2013-06-09 Thread Albert Dengg
Jean Dubois wrote: ... > checkavailablestring='wget -q -O - >http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_'+thisday.strftime("%y%m%d")+'_JO7 >>/dev/null ; echo $?' The problem schould be the echo: Since os.system returns the exit code of the shell, when chaining comma

Re: problem with if then

2013-06-09 Thread Fábio Santos
On 9 Jun 2013 21:24, "Jean Dubois" ... > And here is the result: > > jean@antec4:~$ ./try.py > wget -q -O - http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_130607_JO7 > >/dev/null ; echo $? > 8 > 2013-06-07 22:07:00.016807 stream is available > wget -q -O - http://www.deredac

Re: [newbie] problem with if then

2013-06-09 Thread Roy Smith
In article , 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 In general, "shelling out" to run a command-line utility should be the last resort. It's slower,

Re: problem with if then

2013-06-09 Thread Jean Dubois
On 9 jun, 22:00, Fábio Santos wrote: > 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 > >

Re: [newbie] problem with if then

2013-06-09 Thread Fábio Santos
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 sam

[newbie] problem with if then

2013-06-09 Thread Jean Dubois
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: Here is my code: #!/usr/bin/