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


Groups > comp.lang.python > #25875

Re: reloading code and multiprocessing

References <CAF_E5Jb=_H1D9YwLWGzE+D40U9ji1kFzo1hz=VwB3yzb8=43CA@mail.gmail.com> <CAPTjJmoUkKCe3q_qa7iACw0B0oVdZB-_Mo7xvgJT0nEyaOTdwg@mail.gmail.com> <CAF_E5Ja+3wMdm-jvx9C3fWk9Nwrreu7Q6r9FDwPr4YDFWt5gVQ@mail.gmail.com>
Date 2012-07-24 00:15 +1000
Subject Re: reloading code and multiprocessing
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2472.1343052959.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jul 23, 2012 at 11:51 PM, andrea crotti
<andrea.crotti.0@gmail.com> wrote:
> Anyway the only other problem which I found is that if I start the
> subprocesses after many other things are initialised, it might happen
> that the reloading doesn't work correctly, is that right?
>
> Because sys.modules will get inherited from the subprocesses and it
> will not reimport what has been already imported as far as I
> understood..
>
> So or I make sure I import everything only where it is needed or (and
> maybe better and more explicit) I remove manually from sys.modules all
> the modules that I want to reload, what do you think?

That would probably be correct. However, I still think you may be
fighting against the language instead of playing to its strengths.

I've never fiddled with sys.modules like that, but I know some have,
without problem.

ChrisA

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


Thread

Re: reloading code and multiprocessing Chris Angelico <rosuav@gmail.com> - 2012-07-24 00:15 +1000

csiph-web