October 18th, 2003, 06:10 PM
Make phyton file executable
Can someone tell me how I can run a file named system_test.py with only system.test and not ./system_test.py.
Thank you in advanced.
October 18th, 2003, 07:21 PM
I'm not really sure what you mean, could you give me a little more info?
If you want to execute another Python program from within Python you could check out exec_file(path)..
Or, if u want to run .test files with Python under windows you can select a program from a list if you double click on file, on *nix i dont think it matters which extension the file has as long as the shebang (#!/usr/bin/env python etc.) points to the right place!?
October 18th, 2003, 08:52 PM
Thank you for your post.
I'm using Linux and I have created a system_test.py file.
What I need is to call this file by doing:
system.test -a -f file
where -a -f file are arguments.
I'm currently using ./system_test.py -a -f file to run the script but I need to get rid of the ./system_test.py and call the script with system_test instead.
Is this possible?
October 19th, 2003, 09:36 AM
Remove the .py and place the file in your path.
October 19th, 2003, 03:14 PM
Another method would be to create a symbolic link in something like /usr/bin that points to the file. That way, you don't have to copy your python code all over the place or have a massive PATH environment variable.
Suppose you have a python script called /usr/share/systemtest/system_test.py
Just do the following:
ln -s /usr/share/systemtest/system_test.py /usr/bin/systemtest
Last edited by red_over_blue; October 19th, 2003 at 03:18 PM.