Reloading the already imported module
Paul McGuire
ptmcg at austin.rr._bogus_.com
Thu Jan 11 09:14:05 EST 2007
<anil.pundoor at gmail.com> wrote in message
news:1168519894.160024.70930 at o58g2000hsb.googlegroups.com...
> hi all,
> i have following code
>
>
> if <condition>
> from SIPT.xml_param_mapping import MESSAGE_PARAMETER_MAPPING
> else:
> from SIPT.msg_param_mapping import MESSAGE_PARAMETER_MAPPING
>
> parameter_list = MESSAGE_PARAMETER_MAPPING ['ABC' ]
> for parms in parameter_list:
> parameter_list[parms][4] = 'EXPORT'
> parameter_list[parms][5] = 'IMPORT'
>
>
> After this the xml_param_mapping gets altered. this process is
> repeated over couple of time. But every time i need to get a fresh
> xml_param_mapping. So how to relaod the already imported module??
>
Why not work with a copy of MESSAGE_PARAMETER_MAPPING['ABC'], and keep the
original intact? Change:
parameter_list = MESSAGE_PARAMETER_MAPPING ['ABC' ]
to
parameter_list = MESSAGE_PARAMETER_MAPPING ['ABC' ][:]
Now no reimport is required.
-- Paul
More information about the Python-list
mailing list