[Python-au] Re: Calling two Python Scripts from another script PartII

Karen and Duane Hennessy+ duaneh at connexus.net.au
Mon Dec 1 09:07:30 CET 2003


Gary,
	I agree with you in principal and I personally have not developed 
anything that uses the exec command in code in place of Object Oriented 
program design, but the question was asked and I provided some
solutions, I didn't consider it preaching by any standards. There are a
few reasons we may want to use the exec command, users may be writing
their own script as macros which we would want to look up via
os.listdir and provide a list of possible macros to execute. Perhaps
another program in another language is writing commands based upon
certain criteria during its own processes which need to be run by a
python program at a later stage.
	For example say we had a number of servers writing scripts to a shared 
folder which they all linked to but did not have access to all of the 
folders that made up the tree. Doing a search for these scripts as 
modules would require an __Init__.py file in every folder and sub folder 
to the last one where the files existed and a python method to search 
for and replace any missing __Init__.py files before doing a module 
search. Then again sometimes there could be one script to
run and at others there could be ten, I believe that the exec command
has its uses as in the above examples and others but agree that this
should not be used in place of oo design.

Duane Hennessy
Tropical Queensland, Australia.




More information about the python-au mailing list