1.1 --- a/desktop.py Wed Oct 15 23:17:30 2008 +0200
1.2 +++ b/desktop.py Sat Sep 24 16:30:47 2005 +0000
1.3 @@ -14,6 +14,10 @@
1.4 guessing or detecting which environment is being used.
1.5
1.6 Suggested values for 'desktop' are "KDE" and "GNOME".
1.7 +
1.8 + The process identifier of the "opener" (ie. viewer, editor, browser or
1.9 + program) associated with the 'url' is returned by this function. If the
1.10 + process identifier cannot be determined, None is returned.
1.11 """
1.12
1.13 if desktop == "KDE" or \
1.14 @@ -29,9 +33,12 @@
1.15 cmd = ["gnome-open", url]
1.16
1.17 else:
1.18 - os.startfile(url)
1.19 - return
1.20 + try:
1.21 + # NOTE: This returns None in current implementations.
1.22 + return os.startfile(url)
1.23 + except AttributeError, exc:
1.24 + raise OSError, "Desktop not supported (os.startfile could not be used)"
1.25
1.26 - subprocess.Popen(cmd)
1.27 + return subprocess.Popen(cmd).pid
1.28
1.29 # vim: tabstop=4 expandtab shiftwidth=4