Open PDF

Mike Meyer mwm at
Thu Sep 22 17:42:28 CEST 2005

Dan <dan at> writes:
> Under Linux you can probably use xpdf or gpdf:
>   os.system("xpdf /path/to/file.pdf")
> Note that you should check the return code of "system" to see if the
> execution was successful. For example, the user might not have xpdf
> installed.

This is the problem that the "open" package was designed to
solve. The API for Python apps is still under development, but if you
do 'os.system("open /path/to/file.pdf")', open will use the users
preferred pdf viewer, and interact with the user to select one if they
don't have a prefernce on record.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list