Discussion:
[Tutor] Why is startfile unavailable on my mac?
Nathan Cain
2006-12-04 16:51:58 UTC
Permalink
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?

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?

Thank you.

*******************************************
Nathan Cain
http://www.Web-Magnets.com

Refrigerator Magnets & Promotional Products

Office: 1-877-WEB-MAGNETS (932-6246)
Cell Phone: 1-501-276-0817
Fax: 1-267-295-8776

Click here if you want me to email you
when we run sales or specials.
*******************************************
Mike Hansen
2006-12-04 17:01:13 UTC
Permalink
-----Original Message-----
Sent: Monday, December 04, 2006 9:52 AM
Subject: [Tutor] Why is startfile unavailable on my mac?
import os
os.startfile()
File "<pyshell#10>", line 1, in <module>
os.startfile()
AttributeError: 'module' object has no attribute 'startfile'
Why is this unavailable to me?
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?
Thank you.
*******************************************
Nathan Cain
I just read the docs. I'm assuming that "Availability: Windows" means
that it's Windows only.

Mike
Kent Johnson
2006-12-04 17:03:47 UTC
Permalink
Post by Nathan Cain
import os
os.startfile()
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.
Post by Nathan Cain
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
John Fouhy
2006-12-04 21:53:30 UTC
Permalink
Post by Kent Johnson
The docs for os.startfile() say it is available on Windows only.
Hmm, well you could do a basic Mac version of startfile like this:

def startfile(fn):
os.system('open %s' % fn)
--
John.
Loading...