[Tutor] Why is startfile unavailable on my mac?
Kent Johnson
kent37 at tds.net
Mon Dec 4 18:03:47 CET 2006
Nathan Cain wrote:
> When I type the following in macpython IDLE,:
>
>> >> import os
>> >> os.startfile()
>
> I get the following error:
>
> Traceback (most recent call last):
> File "<pyshell#10>", line 1, in <module>
> os.startfile()
> AttributeError: 'module' object has no attribute 'startfile'
>
> Why is this unavailable to me?
The docs for os.startfile() say it is available on Windows only.
>
> I am trying to open a url in a browser window.
>
> If startfile is just not available on the mac, can someone please give
> me some simple example code that will open http://www.python.org in a
> safari window?
Try webbrowser.open('http://www.python.org')
Kent
More information about the Tutor
mailing list