On Fri, 2002-10-25 at 10:48, Jason Hildebrand wrote:
> On Fri, 2002-10-25 at 01:40, Ian Bicking wrote:
> > Looks good. I changed it a bit so it would also monitor modules that
> > were loaded before ImportSpy was started up (e.g., Application.py). It
> > would be good to also add any configuration files -- I suppose a hook
> > could be added to Configurable.
> Good idea!
> > To do that ImportSpy should probably
> > not auto-install itself, since Configurable would have to check if
> > ImportSpy was on.
> Well right now ImportSpy hooks itself in regardless of whether
> AutoReload is activated or not. I would have preferred to have
> AutoReloadingAppServer install the ImportSpy hook, but I also wanted
> ImportSpy to get hooked in as soon as possible, so that most modules get
> monitored. Do you see a better way of doing this?
Well, all modules that are loaded get added now, even if ImportSpy
hadn't been started yet. So it's not a problem if it's slow to start
> > Another feature that would be nice would be adding checking Python
> > standard libraries. On Unix that will generally be files starting in
> > /usr/lib/pythonX.X -- but that's obviously not general, even on Unix.
> > I'm not sure how to identify that directory. It might be
> > os.path.join(sys.prefix, 'lib/python%i.%i' % (sys.version_info,
> > sys.version_info)).
> Could we use access() to check for write permissions? Standard python
> modules would be installed without write permissions for most users.
> But then again, people might run their appservers under a user which
> doesn't have write permissions on any of their servlets, for security
> reasons. I don't see a good general way of solving this.
Yeah, I guest that won't work. That last idea I gave (os.path.join...)
might be correct, though -- it matches all the directories Stefan gave
> > I did have a problem with the actual restart, though. It shuts down and
> > I get:
> > /usr/bin/python: can't open file 'Launch.py'
> > I don't get it -- I'm starting it up from ./AppServer (in the WebKit
> > directory). $PWD is the WebKit directory. Launch.py is in the WebKit
> > directory. So I don't know why it isn't working.
> Hmm... Launch.py changes the working directory to the Webware directory
> (one level up from WebKit), so that's probably why autoreload doesn't
> work in this case. If you called AppServer with the full path it would
> likely work. Is there a good way to fix this? I guess we could
> translate the value of sys.argv to take the chdir into account when
> the appserver is called with a relative pathname.
Yes, that sounds right. But the environmental variable PWD remains the
same... but I guess that doesn't matter. I guess we'll just have to
track the original directory, and do a chdir before restarting.