start default application for read a pdf from python
Grant Edwards
invalid at invalid
Tue Sep 8 16:01:13 EDT 2009
On 2009-09-08, Angelo Ballabio <angbal at email.it> wrote:
> I try to start a default application for reading a pdf file
> inside the python script.
>
> I try
>
> os.startfile(name,option) but say me startfile not implemented
Are you _sure_ it says startfile not implemented? Or does
it say this:
>>> os.startfile("foo.bar")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'startfile'
[You'll always get better answers if your questions are
specific and precise -- whenever possible, you should paste in
actual code and error messages.]
> there are some system to start for example acrobar or okular
> from the script with a name of pdf file?
Google tells me that Okular is something for KDE. That implies
that you're running Linux or Unix? [When asking a question, you
also need to provide OS, Python version, etc.]
If you are running Linux/Unix, then I suspect the answer to
your problem can be seen in the fine documentation at
http://docs.python.org/library/os.html#process-management
os.startfile(path[, operation])
Start a file with its associated application.
[...]
Availability: Windows.
If you want to do something similar on Unix/Linux, you'll
probably need to call some desktop-specific.
Googling for python+startfile+linux found me these links:
http://mail.python.org/pipermail/python-list/2003-March/193897.html
http://lists.freebsd.org/pipermail/freebsd-python/2004-August/000138.html
--
Grant Edwards grante Yow! FOOLED you! Absorb
at EGO SHATTERING impulse
visi.com rays, polyester poltroon!!
More information about the Python-list
mailing list