[Tutor] iexplore scheduler

Toby toby.pas at gmail.com
Fri Feb 29 19:12:19 CET 2008


Start-programs-accessories-system tools-scheduled tasks
Browse to program files internet explorer and choose iexplore.exe
Set the schedule to run at the right time
Finish the schedule and then go back and edit the task and add the url after
the command so it will look like this:

"C:\Program Files\Internet Explorer\IEXPLORE.EXE"  http://www.askjeeves.com
Obviously you want your web addy at the end outside the ""'s

That should do what you want, alternately you could call the command from
inside python as suggested using the above system call

Hope that helps

Toby

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of tutor-request at python.org
Sent: Friday, February 29, 2008 9:06 AM
To: tutor at python.org
Subject: Tutor Digest, Vol 48, Issue 71

Send Tutor mailing list submissions to
	tutor at python.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://mail.python.org/mailman/listinfo/tutor
or, via email, send a message with subject or body 'help' to
	tutor-request at python.org

You can reach the person managing the list at
	tutor-owner at python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tutor digest..."


Today's Topics:

   1. How to open IE7 to a certain URL? (Dick Moores)
   2. comparison bug in python  (or do I not get it?) (Hans Fangohr)
   3. Re: How to open IE7 to a certain URL? (Tim Golden)
   4. Re: How to open IE7 to a certain URL? (Kent Johnson)
   5. Re: How to open IE7 to a certain URL? (Tim Golden)
   6. Re: comparison bug in python  (or do I not get it?) (Kent Johnson)
   7. Re: comparison bug in python  (or do I not get it?) (Hans Fangohr)
   8. Re: comparison bug in python (or do I not get it?)
      (Luciano Ramalho)
   9. Re: How to open IE7 to a certain URL? (Dick Moores)
  10. Re: How to open IE7 to a certain URL? (Dick Moores)


----------------------------------------------------------------------

Message: 1
Date: Fri, 29 Feb 2008 04:28:50 -0800
From: Dick Moores <rdm at rcblue.com>
Subject: [Tutor] How to open IE7 to a certain URL?
To: Python Tutor List <tutor at python.org>
Message-ID: <20080229122924.14F8D1E4003 at bag.python.org>
Content-Type: text/plain; charset="us-ascii"; format=flowed

I keep missing a certain weekly program on my local NPR station. My 
idea is to record it using software I have, Easy Hi-Q Recorder. I can 
set it to start recording when the program starts, 8pm, but I need to 
have the program playing on my computer. The URL for the station's 
audio is http://www.kuow.org/real.ram .

I've got this so far:

#!/usr/bin/env python
#coding=utf-8
import time
b = '20:00:00'
while True:
     a = time.strftime('%H:%M:%S')
     time.sleep(0.5)
     if a == b:
         print "TIME!"
         break

Obviously, I need to replace the  'print "TIME"'  line with something 
that will open IE7 to http://www.kuow.org/real.ram . But what?

Thanks,

Dick Moores



------------------------------

Message: 2
Date: Fri, 29 Feb 2008 12:29:42 +0000 (GMT)
From: Hans Fangohr <h.fangohr at soton.ac.uk>
Subject: [Tutor] comparison bug in python  (or do I not get it?)
To: tutor at python.org
Cc: Thomas Fischbacher <tf at functionality.de>
Message-ID: <Pine.OSX.4.61.0802291219030.1220 at jarjar.kk.soton.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Dear Python folks,

here is a sequence of commands (ipython) that lead to a question. 
See my comments after leading '#':

In [1]: 2 in [1,2,3]
Out[1]: True

#nothing special here, of course 2 is in the list.

In [2]: 2 in [1,2,3] == True
Out[2]: False

#This is somewhat surprising, as one would hope that '2 in [1,2,3]'
#evaluates to 'True', and then we expect 'True'=='True' to hold.
#However, maybe it is an issue of operator precedence. Let's add
parenthesis:

In [3]: (2 in [1,2,3]) == True
Out[3]: True

#Okay, so this does what we expect. 
#However, if it is an issue of operator precedence, then what is the 
#operation that is carried out at prompt [2] above?
#
#Presumably, we work out

In [4]: [1,2,3] == True
Out[4]: False

#which is false. So effectively, The statement at [2] seems to boil down to

In [5]: 2 in False
 
---------------------------------------------------------------------------
   exceptions.TypeError                                 Traceback (most
recent call last)

   /Volumes/Minmax250a/Users2/fangohr/<console>

   TypeError: iterable argument required

But this throws an error! And so does the full expression (with
paranthesis):

In [6]: 2 in ([1,2,3] == True)
 
---------------------------------------------------------------------------
   exceptions.TypeError                                 Traceback (most
recent call last)

   /Volumes/Minmax250a/Users2/fangohr/<console>

   TypeError: iterable argument required



So what is the story here? In my view, the statement in line [2]
should either produce True (as in [3]), or throw an error (as in [6]).

Why does [2] return False? Would people agree that this is a bug?


Thank you for your time,

Hans



PS I have tested this with Python 2.4, and Python 2.5 (on debian etch)


--
Hans Fangohr

School of Engineering Sciences 
University of Southampton 
Phone: +44 (0) 238059 8345

Email: fangohr at soton.ac.uk
http://www.soton.ac.uk/~fangohr






------------------------------

Message: 3
Date: Fri, 29 Feb 2008 13:07:20 +0000
From: Tim Golden <mail at timgolden.me.uk>
Subject: Re: [Tutor] How to open IE7 to a certain URL?
Cc: Python Tutor List <tutor at python.org>
Message-ID: <47C80388.2070106 at timgolden.me.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dick Moores wrote:
> I keep missing a certain weekly program on my local NPR station. My 
> idea is to record it using software I have, Easy Hi-Q Recorder. I can 
> set it to start recording when the program starts, 8pm, but I need to 
> have the program playing on my computer. The URL for the station's 
> audio is http://www.kuow.org/real.ram .
> 
> I've got this so far:
> 
> #!/usr/bin/env python
> #coding=utf-8
> import time
> b = '20:00:00'
> while True:
>      a = time.strftime('%H:%M:%S')
>      time.sleep(0.5)
>      if a == b:
>          print "TIME!"
>          break
> 
> Obviously, I need to replace the  'print "TIME"'  line with something 
> that will open IE7 to http://www.kuow.org/real.ram . But what?

Sidestepping slightly, the natural way to open a URL using
whatever's set up to do so is with os.startfile:

<code>
import os

os.startfile ("http://whatever...ram")

</code>

I was going to say that, to use IE7 explicitly, you should
use the webbrowser module. But then I realised that, for
reasons which I'm sure are extremely good but which elude
me for now, iexplorer is not one of the registered browsers.

As a fallback, you can look for its apppath entry in the registry
and use subprocess to call that.

TJG


------------------------------

Message: 4
Date: Fri, 29 Feb 2008 08:14:30 -0500
From: Kent Johnson <kent37 at tds.net>
Subject: Re: [Tutor] How to open IE7 to a certain URL?
To: Dick Moores <rdm at rcblue.com>
Cc: Python Tutor List <tutor at python.org>
Message-ID: <47C80536.5070000 at tds.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dick Moores wrote:

> #!/usr/bin/env python
> #coding=utf-8
> import time
> b = '20:00:00'
> while True:
>      a = time.strftime('%H:%M:%S')
>      time.sleep(0.5)
>      if a == b:

You might want to learn how to use your OS's scheduler to do this part. 
I don't know what it is on Windows though.

Kent


------------------------------

Message: 5
Date: Fri, 29 Feb 2008 13:19:57 +0000
From: Tim Golden <mail at timgolden.me.uk>
Subject: Re: [Tutor] How to open IE7 to a certain URL?
Cc: Python Tutor List <tutor at python.org>
Message-ID: <47C8067D.2020109 at timgolden.me.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Kent Johnson wrote:
> Dick Moores wrote:
> 
>> #!/usr/bin/env python
>> #coding=utf-8
>> import time
>> b = '20:00:00'
>> while True:
>>      a = time.strftime('%H:%M:%S')
>>      time.sleep(0.5)
>>      if a == b:
> 
> You might want to learn how to use your OS's scheduler to do this part. 
> I don't know what it is on Windows though.

You've got a couple of options on Windows, actually (not including
any roll-you-own or ported cron efforts). You can either use the
AT command (from the command line or via WMI) or you can use the
Windows scheduler, either from the control panel or programatically
via the win32com.taskscheduler module from pywin32.

TJG


------------------------------

Message: 6
Date: Fri, 29 Feb 2008 08:21:09 -0500
From: Kent Johnson <kent37 at tds.net>
Subject: Re: [Tutor] comparison bug in python  (or do I not get it?)
To: Hans Fangohr <h.fangohr at soton.ac.uk>
Cc: tutor at python.org
Message-ID: <47C806C5.4060409 at tds.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hans Fangohr wrote:

> In [2]: 2 in [1,2,3] == True
> Out[2]: False
> 
> Why does [2] return False? Would people agree that this is a bug?

No, not a bug. Don't be too quick to blame your tools!

The equivalent expression is
In [1]: (2 in [1,2,3]) and ([1,2,3]==False)
Out[1]: False

'in' is considered a comparison operator and can be chained with other 
comparisons. For a clearer example, consider
In [2]: 2 < 3 < 4
Out[2]: True

which is not the same as
In [3]: 2 < (3 < 4)
Out[3]: False

or
In [4]: (2 < 3) < 4
Out[4]: True

It is equivalent to
In [5]: (2 < 3) and (3 < 4)
Out[5]: True

See
http://docs.python.org/ref/comparisons.html

Kent


------------------------------

Message: 7
Date: Fri, 29 Feb 2008 13:42:43 +0000 (GMT)
From: Hans Fangohr <h.fangohr at soton.ac.uk>
Subject: Re: [Tutor] comparison bug in python  (or do I not get it?)
To: Kent Johnson <kent37 at tds.net>, Thomas Fischbacher
	<tf at functionality.de>
Cc: tutor at python.org
Message-ID: <Pine.OSX.4.61.0802291340560.1220 at jarjar.kk.soton.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Hi Kent,

> Hans Fangohr wrote:
>
>> In [2]: 2 in [1,2,3] == True
>> Out[2]: False
>>
>> Why does [2] return False? Would people agree that this is a bug?
>
> No, not a bug. Don't be too quick to blame your tools!

That's good news. I'd be worried if this wasn't the desired behaviour
-- I just hadn't understood the logic.

>
> The equivalent expression is
> In [1]: (2 in [1,2,3]) and ([1,2,3]==False)
> Out[1]: False

Ah -- that's the way to read it!

>
> 'in' is considered a comparison operator and can be chained with other
> comparisons. For a clearer example, consider
> In [2]: 2 < 3 < 4
> Out[2]: True
>
> which is not the same as
> In [3]: 2 < (3 < 4)
> Out[3]: False
>
> or
> In [4]: (2 < 3) < 4
> Out[4]: True
>
> It is equivalent to
> In [5]: (2 < 3) and (3 < 4)
> Out[5]: True
>

Well explained -- makes perfect sense now.

Many thanks,

Hans



> See
> http://docs.python.org/ref/comparisons.html
>
> Kent
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>

--
Hans Fangohr

School of Engineering Sciences 
University of Southampton 
Phone: +44 (0) 238059 8345

Email: fangohr at soton.ac.uk
http://www.soton.ac.uk/~fangohr






------------------------------

Message: 8
Date: Fri, 29 Feb 2008 11:32:55 -0300
From: "Luciano Ramalho" <luciano at ramalho.org>
Subject: Re: [Tutor] comparison bug in python (or do I not get it?)
To: "Kent Johnson" <kent37 at tds.net>
Cc: Hans Fangohr <h.fangohr at soton.ac.uk>, tutor at python.org
Message-ID:
	<4331ad810802290632u3cdc3199o17769957aaba3fc2 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Feb 29, 2008 at 10:21 AM, Kent Johnson <kent37 at tds.net> wrote:
>  No, not a bug. Don't be too quick to blame your tools!

Well said, Kent.

Here's a generic tip to anyone learning Python.

I learned Python after working professionally with several languages
for many years, including Java and Delphi, and I can say that Python
is *very* well designed, is implemented with the highest standards of
software engineering and caters to a rigorous and expert audience.

It is **extremely** unlikely that you will ever find a bug in the
interpreter or the built-ins if you are using a released version of
Python. I've been using Python professionally since 1998 and I never
stumbled upon a single bug anywhere in a released Python distribution.
Of course, there are bugs and even security hot-fixes are issued from
time to time. But I've never been affected by a Python bug in my
projects.

So it's better to assume that any strange behaviour is actually some
misunderstanding on your part than a bug.

Cheers,

Luciano


------------------------------

Message: 9
Date: Fri, 29 Feb 2008 06:58:57 -0800
From: Dick Moores <rdm at rcblue.com>
Subject: Re: [Tutor] How to open IE7 to a certain URL?
To: Python Tutor List <tutor at python.org>
Message-ID: <20080229145903.10CD91E4003 at bag.python.org>
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL:
http://mail.python.org/pipermail/tutor/attachments/20080229/a37eafbc/attachm
ent-0001.htm 

------------------------------

Message: 10
Date: Fri, 29 Feb 2008 07:06:19 -0800
From: Dick Moores <rdm at rcblue.com>
Subject: Re: [Tutor] How to open IE7 to a certain URL?
To: Python Tutor List <tutor at python.org>
Message-ID: <20080229150625.90B191E401B at bag.python.org>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 05:19 AM 2/29/2008, Tim Golden wrote:
>Kent Johnson wrote:
> > Dick Moores wrote:
> >
> >> #!/usr/bin/env python
> >> #coding=utf-8
> >> import time
> >> b = '20:00:00'
> >> while True:
> >>      a = time.strftime('%H:%M:%S')
> >>      time.sleep(0.5)
> >>      if a == b:
> >
> > You might want to learn how to use your OS's scheduler to do this part.
> > I don't know what it is on Windows though.
>
>You've got a couple of options on Windows, actually (not including
>any roll-you-own or ported cron efforts). You can either use the
>AT command

The XP help says that rather than AT, to use schtasks. I'm trying to 
figure it out now..

>  (from the command line or via WMI)

Windows Management Instrumentation is a whole new world to me, but I 
understand (from Wikipedia) that XP has it. I wish you'd quit opening 
up these cans of worms!  ;-)

>or you can use the
>Windows scheduler, either from the control panel or programatically
>via the win32com.taskscheduler module from pywin32.

Thanks again,

Dick Moores




------------------------------

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor


End of Tutor Digest, Vol 48, Issue 71
*************************************



More information about the Tutor mailing list