Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 18th, 2003, 05:10 PM
initpcsys initpcsys is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 11 initpcsys User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old October 18th, 2003, 06:21 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old October 18th, 2003, 07:52 PM
initpcsys initpcsys is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 11 initpcsys User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old October 19th, 2003, 08:36 AM
percivall percivall is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 133 percivall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Remove the .py and place the file in your path.

Reply With Quote
  #5  
Old October 19th, 2003, 02:14 PM
red_over_blue red_over_blue is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 9 red_over_blue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 28 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Make phyton file executable

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap