running multiple scripts -- which way is more elegant?
Terry Reedy
tjreedy at udel.edu
Mon Jun 20 13:48:34 EDT 2011
On 6/20/2011 2:51 AM, Stephen Bunn wrote:
> Thanks for the replies. I would like to use the second method because I
> plan to implement everything in python.
The main problem of your second method is that you repeat the check
function in each script. That will be a problem if you ever want to
modify it. I might put is into a separate file and import into each script.
Unfortunately I have not been
> able to work out how to get the imports to work.
>
> import config_script obviously doesn't work and
> __import__(config_script) works from the python interpreter but fails in
> the script (ImportError: Import by filename is not supported.)
Look at builtin function __import__(filename).
--
Terry Jan Reedy
More information about the Python-list
mailing list