Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8021
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: running multiple scripts -- which way is more elegant? |
| Date | 2011-06-20 13:48 -0400 |
| References | <BANLkTi=t9cHtPN6QOa4eUWuraZToOZxnoQ@mail.gmail.com> <BANLkTi=hHPo3ap9Cys40DX7wGdTEbn44OQ@mail.gmail.com> <BANLkTimBCVF7ed_sf3h-a4CA=gZpP4gCcA@mail.gmail.com> <BANLkTikpoGKrmNxYni+e+AcRiVzOEFWFQA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.185.1308592128.1164.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: running multiple scripts -- which way is more elegant? Terry Reedy <tjreedy@udel.edu> - 2011-06-20 13:48 -0400
csiph-web