472,334 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

help in execfile function

Hi

i have 3 python files and i want to execute the files sequentially
using the execfile command.Hence ,i have written the following program
fileList = ["a.py","b.py","c.py"]

for fileName in fileList :
execfile(fileName)

however,when i try running it,the program keeps calling execfile on
a.py and thus an infinite loop is created.I am running this on Windows
XP.

Please suggest a sloution whereby i can use execfile to execute all
files in fileList.Please tell me where in my program i may have gone
wrong.

moijes12
Sep 4 '08 #1
1 1487
On Thu, 04 Sep 2008 05:03:57 -0700, moijes12 wrote:
Hi

i have 3 python files and i want to execute the files sequentially using
the execfile command.Hence ,i have written the following program
fileList = ["a.py","b.py","c.py"]

for fileName in fileList :
execfile(fileName)

however,when i try running it,the program keeps calling execfile on a.py
and thus an infinite loop is created.I am running this on Windows XP.
Change the line "execfile(fileName)" to "print fileName" and you may
discover that the problem isn't with execfile but with your code.

Then read about modules and import, and you may discover that there is a
better way than execfile.
(I wish that eval, exec and execfile were hidden in a module where noobs
couldn't trip over them and decide they are the answer to every problem.
Sigh.)

Please suggest a sloution whereby i can use execfile to execute all
files in fileList.Please tell me where in my program i may have gone
wrong.
Looking into my crystal ball, I'm guessing that file a.py contains a line
that says "execfile('a.py')".

--
Steven
Sep 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jonathan | last post by:
I'm puzzled by Python's behavior when binding local variables which are introduced within exec() or execfile() statements. First, consider this...
3
by: v.vayer | last post by:
I need to execfile() from a function in order to set value for a global variable from inside the executed file. I know there are "globals" and...
2
by: Mardy | last post by:
Hi all, I have written a slightly modified version of the CGIHTTPServer; the difference with the module included in the standard python...
3
by: Mardy | last post by:
Hi all, I'm starting to think the way I've implemented my program (http://www.mardy.it/eligante) is all wrong. Basically, what I want is a web...
8
by: R. Bernstein | last post by:
In doing the extension to the python debugger which I have here: http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 I...
2
by: Alex Popescu | last post by:
Hi all! not be present in Py3k. So, I am wondering what will be its replacement? Considering that most probably Py3k will keep eval and exec,...
1
by: Fernando Perez | last post by:
Hi all, I'm finding the following behavior truly puzzling, but before I post a bug report on the site, I'd rather be corrected if I'm just...
2
by: Dave Westerman | last post by:
I've got a Jython script where I'm doing an execfile() to pull in a small script that contains a function, which I then call. ...
5
by: George Sakkis | last post by:
I maintain a few configuration files in Python syntax (mainly nested dicts of ints and strings) and use execfile() to read them back to Python....
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.