Re: [Tutor] Code to open a website

2013-02-11 Thread Alan Gauld
On 11/02/13 01:14, Steven D'Aprano wrote: exit() and quit() (as added by the site.py module) are for interactive use. aha! They're mostly there for the benefit of newbies. Experienced developers (at least in the Unix/Linux world) usually know to exit interactive terminal apps with Ctrl-D. I

Re: [Tutor] Code to open a website

2013-02-10 Thread Steven D'Aprano
On 10/02/13 20:25, ALAN GAULD wrote: Maybe the OP meant to say 'quit()' ? That does not require an import. Ooh! another option I didn't know about! So many ways to get rid of Python and here's me been importing sys or raising SystemExit all these years... :-) exit() and quit() (as added

Re: [Tutor] Code to open a website

2013-02-10 Thread eryksun
On Sun, Feb 10, 2013 at 3:39 AM, ALAN GAULD wrote: > So it does. You learn something new every day... > When did that first happen? It was one of my biggest frustrations > with Python when I first started learning, that you couldn't call exit > without first importing sys (v1.3). But I never notic

Re: [Tutor] Code to open a website

2013-02-10 Thread Peter Otten
ALAN GAULD wrote: >> Maybe the OP meant to say 'quit()' ? That does not require an import. > > > Ooh! another option I didn't know about! > So many ways to get rid of Python and here's me been importing sys > or raising SystemExit all these years... :-) I tend to use none of these and my script

Re: [Tutor] Code to open a website

2013-02-10 Thread ALAN GAULD
> Maybe the OP meant to say 'quit()' ? That does not require an import. Ooh! another option I didn't know about! So many ways to get rid of Python and here's me been importing sys  or raising SystemExit all these years... :-) Alan G. ___ Tutor mailli

Re: [Tutor] Code to open a website

2013-02-10 Thread Albert-Jan Roskam
> On Sat, Feb 9, 2013 at 8:33 PM, Alan Gauld > wrote: >> >> Where does exit() come from? Usually its from sys but you >> don't import from sys anywhere... > > site.py adds the exit/quit Quitter instances to builtins (2.x > __builtin__). When called they raise SystemExit, like sys.exit does

Re: [Tutor] Code to open a website

2013-02-10 Thread ALAN GAULD
>site.py adds the exit/quit Quitter instances to builtins (2.x >__builtin__). When called they raise SystemExit, like sys.exit does. So it does. You learn something new every day... When did that first happen? It was one of my biggest frustrations  with Python when I first started learning, that

Re: [Tutor] Code to open a website

2013-02-09 Thread mann kann
oh wow, I foolishly named it webbrowser.py earlier. Thanks for the witty hint, Danny :) On Sat, Feb 9, 2013 at 11:55 PM, Danny Yoo wrote: > On Sat, Feb 9, 2013 at 6:25 PM, mann kann wrote: > > I used webbrowser and it worked via terminal, but the same code returns > > AttrituteError: 'module'

Re: [Tutor] Code to open a website

2013-02-09 Thread Danny Yoo
On Sat, Feb 9, 2013 at 6:25 PM, mann kann wrote: > I used webbrowser and it worked via terminal, but the same code returns > AttrituteError: 'module' object has no attribute 'open' in komodo edit. > suggestions? here's the code: > > import webbrowser > webbrowser.open("http://youtube.com";) What

Re: [Tutor] Code to open a website

2013-02-09 Thread eryksun
On Sat, Feb 9, 2013 at 8:33 PM, Alan Gauld wrote: > > Where does exit() come from? Usually its from sys but you > don't import from sys anywhere... site.py adds the exit/quit Quitter instances to builtins (2.x __builtin__). When called they raise SystemExit, like sys.exit does. Since you can bypa

Re: [Tutor] Code to open a website

2013-02-09 Thread Alan Gauld
On 10/02/13 01:00, mann kann wrote: Dear Jedi, I wrote my first program but it doesn't open a website as I intended it to. Please correct my mistake. Well, how did you intend it to? It looks like it probably does open the web site, but it will be hard to tell since you do nothing with the res

Re: [Tutor] Code to open a website

2013-02-09 Thread mann kann
I used webbrowser and it worked via terminal, but the same code returns AttrituteError: 'module' object has no attribute 'open' in komodo edit. suggestions? here's the code: import webbrowser webbrowser.open("http://youtube.com";) On Sat, Feb 9, 2013 at 8:17 PM, Wayne Werner wrote: > On Sat,

Re: [Tutor] Code to open a website

2013-02-09 Thread Wayne Werner
On Sat, 9 Feb 2013, mann kann wrote: Dear Jedi,  I wrote my first program but it doesn't open a website as I intended it to. Please correct my mistake.  Sincerely,  Mann You'll actually want the webbrowser module, which will open the links in your web browser - at least if you want to load s

[Tutor] Code to open a website

2013-02-09 Thread mann kann
Dear Jedi, I wrote my first program but it doesn't open a website as I intended it to. Please correct my mistake. Sincerely, Mann def a(): import urllib.request url = "http://www.google.com"; response = urllib.request.urlopen(url) g = input("Please enter y or n to go to youtube :