473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How do I execute another program within a python program?

I'm very new to python (about two days experience) and have made a few basic programs so far. Now I want to try to make a program in which the user will input a file name and the file will execute, but I haven't been able to find the last piece I need.

So far I have a basic:
Expand|Select|Wrap|Line Numbers
  1. print "Enter program name.\nFor a list of programs type 'List'" #intro text
  2. program = raw_input("Program: ") #asks user for program
  3. while program == "List": #lists program names
  4.     print "Collatz.py"
  5.     #the program list continues with a few more names
  6.     program = raw_input("Program: ") #asks for new input
  7.  
I have tried maybe 50 different ways to get the program inputted to function but I can't seem to make it work.
Oct 16 '10 #1
0 1131

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Will Stuyvesant | last post by:
I never used the popen or popen2 libraries but it is my understanding that they can capture the output of console based programs. Is it also possible to send keystrokes to console base programs? ...
2
by: Joe Richett | last post by:
Hi all, I have a python program and I have some "user defined" command stored in a separate text file. Is there a builtin command with which I can load the "user defined"-file and execute every...
5
by: Max Powers | last post by:
I've spent an interesting day searching the web for help with calling OCaml functions from a python program and have come to the newsgroup for some advice (unfortunately I'm learning both languages...
3
by: Kenneth McDonald | last post by:
After looking around at various editors, I've finally decided on (I think :-) ) Vim for my future work. (jed is a great editor, but doesn't do neat things like allow me to write python code to add...
7
by: fileexit | last post by:
How can I execute shell commands from within python. Specifically, I am looking for something like the shell "cat". But this also made me wonder how to execute shell commands anyway, just if i...
7
by: damacy | last post by:
hi, there. i have this question which might sound quite stupid to some people, but here we go anyway. i have written a python program which interacts with a postgresql database. what it does is...
3
by: frankrentef | last post by:
Greetings all... Newbie to Python... need help with opening a file from within Python... see the following code. import popen2 stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1')...
1
by: =?ISO-8859-1?Q?Andr=E9?= | last post by:
Hi everyone, I'd be interested in hearing suggestions as to the "best" way to drive a Python program step by step from another application. Details: --------- I have implemented a "Robot"...
3
by: Scott | last post by:
I have a requirement to control a firefox web browser from an external python program. The python program running under linux from a command shell needs to first find all open firefox web browser...
0
by: bruce | last post by:
hi mike.... you might look at/into selenium, or firewatir.... check the spellings! -peace -----Original Message-----
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.