startfile() equivalent

Hye-Shik Chang hyeshik at gmail.com
Wed Aug 18 19:19:08 PDT 2004


On Wed, 18 Aug 2004 11:09:43 +0100 (BST), Max Russell
<max_russell2000 at yahoo.co.uk> wrote:
> Hello-
> 
> I'm scripting a little thing to pick a random MAME
> file and launch it (save me the hassle of choosing
> one).
> 

> Does startfile work on BSD/Linux?

os.startfile() is only available in Windows.

> How can I do the equivalent to the python win32
> startfile()?
> 
> If I cannot use this, how can I say execute this command?
> 

It depends what your desktop environment is.  If you run GNOME,
you can write it like this:

 import os
 def startfile(url):
   os.system("gnome-open " + url) # quote if you can't trust user.


Hye-Shik


More information about the freebsd-python mailing list