|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Make phyton file executable
Hello everyone,
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. Take care, I. |
|
#2
|
||||
|
||||
|
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!? Have fun, Mark. |
|
#3
|
|||
|
|||
|
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? Take care, I. |
|
#4
|
|||
|
|||
|
Remove the .py and place the file in your path.
|
|
#5
|
|||
|
|||
|
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: Code:
ln -s /usr/share/systemtest/system_test.py /usr/bin/systemtest Last edited by red_over_blue : October 19th, 2003 at 02:18 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Make phyton file executable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|