[Tutor] Question on how to open other programs and files
Hi
haztang17 at gmail.com
Sun Feb 8 07:09:04 CET 2009
I have a question regarding how to open other programs and files in Python
code. I am creating a simple interface and I want it to be able to open
other files, such as a text file or a pdf file. However, those files are
usually associated with other programs - for instance, gedit for text and
document viewer for pdf (I am using Ubuntu 8.10). What syntax or commands do
I need in order to do so. I've used os.popen in Windows XP and it works
fine, but the same code does not work in Ubuntu. This is the part of my code
that deals with opening files/programs:
def openfile(self, event):
result = os.popen("home/user/textfile.txt")
In the terminal it simply says, sh: home/user/textfile.txt: not found. And I
have already set permissions via chmod +x on the files of my choosing. Any
help would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090207/83a89869/attachment.htm>
More information about the Tutor
mailing list