# HG changeset patch # User paulb # Date 1127579447 0 # Node ID c81d5b8d261ac12a771c22a43c46524fb4fa332b # Parent 21f338324a7e870b32dafa19561b12e6c0bf5116 [project @ 2005-09-24 16:30:47 by paulb] Returned the process identifier of the opener; added docstring to describe this. Added an exception around os.startfile usage. diff -r 21f338324a7e -r c81d5b8d261a desktop.py --- a/desktop.py Wed Oct 15 23:17:30 2008 +0200 +++ b/desktop.py Sat Sep 24 16:30:47 2005 +0000 @@ -14,6 +14,10 @@ guessing or detecting which environment is being used. Suggested values for 'desktop' are "KDE" and "GNOME". + + The process identifier of the "opener" (ie. viewer, editor, browser or + program) associated with the 'url' is returned by this function. If the + process identifier cannot be determined, None is returned. """ if desktop == "KDE" or \ @@ -29,9 +33,12 @@ cmd = ["gnome-open", url] else: - os.startfile(url) - return + try: + # NOTE: This returns None in current implementations. + return os.startfile(url) + except AttributeError, exc: + raise OSError, "Desktop not supported (os.startfile could not be used)" - subprocess.Popen(cmd) + return subprocess.Popen(cmd).pid # vim: tabstop=4 expandtab shiftwidth=4