Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8014

Re: running multiple scripts -- which way is more elegant?

References <BANLkTi=t9cHtPN6QOa4eUWuraZToOZxnoQ@mail.gmail.com> <BANLkTi=hHPo3ap9Cys40DX7wGdTEbn44OQ@mail.gmail.com> <BANLkTimBCVF7ed_sf3h-a4CA=gZpP4gCcA@mail.gmail.com> <BANLkTikpoGKrmNxYni+e+AcRiVzOEFWFQA@mail.gmail.com>
Date 2011-06-20 16:19 +0200
Subject Re: running multiple scripts -- which way is more elegant?
From Florencio Cano <florencio.cano@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.181.1308579599.1164.python-list@python.org> (permalink)

Show all headers | View raw


> 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.)

You can use this:

exec("import " + module_name)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: running multiple scripts -- which way is more elegant? Florencio Cano <florencio.cano@gmail.com> - 2011-06-20 16:19 +0200

csiph-web