User Profile
Collapse
-
Thanks again. Is there any way I can open the file using another program, but it's called by the Python script? For example, if I want to use my Python script to open a text file using gedit or a pdf file using document viewer. Because ultimately I want to leave the terminal and have as much "GUI" as possible. Is there a generic way to open a file that may be handled by another program (such as, again, gedit for text or document viewer... -
Thanks for the reply again. Your method does indeed work for my situation; however, I don't know how to implement it. Like I've said above, I really only know the system and popen commands to open/execute a program or file. How would I use the correct syntax to make this work? Like what I have now would be result = os.system(path/somefile.txt), but that doesn't work. Sorry for the newbieness... just having a hard time grasping all the finer details...Leave a comment:
-
I'm just testing waters with the features in Python. So the program will be able to open other programs as well as open files (such as text files). I was looking into this, and the other one to my knowledge would be the os.system, but neither one worked. Basically I just want to know the commands to open other programs as well as files. I've tried looking online but could not find one that would work. It works in Windows, but Ubuntu is a different...Leave a comment:
-
Thanks everyone! I will try and see what I can do. However, I have encountered a second problem. The os.popen command with the file location given does not seem to work at all in Ubuntu. For instance, if I just have
os.popen('/home/scaldo/Desktop/somefile.txt')
does not work. Even if I use chmod +x somefile.txt and I know the file location is correct.I am new at Ubuntu, and the Linux world in general. Is there something...Leave a comment:
-
Thank you very much for the reply bvdet! I think even though you misunderstood me, you still managed to answer half of my question! What I am asking is my main interface python file and any other python scripts I want to call are all in the same folder. The issue is the folder may not always be in program files; it could be on desktop (which could be something like c:\documents and settings\userna me\desktop), it could be just in c:\, etc. So the...Leave a comment:
-
How to execute a program in python script directory
I am just starting out on Python and trying to make a simple interface as practice. Right now I can execute a program through the os.popen command. However, I have to specify the directory where the program is located. For example, say:
os.popen("c:\pr ogram^files\pro gramb.py")
Is there any way I can tell Python to assume the default directory is wherever the interface script is ran from? So say I have a folder...
No activity results to display
Show More
Leave a comment: