[IPython-user] Trouble importing my own modules?

Greg Novak novak@ucolick....
Tue Jun 12 14:23:21 CDT 2007


On 6/12/07, Brian Granger <ellisonbg.net@gmail.com> wrote:
> Currently, multiple users can connect to a single controller.  As
> Fernando mentioned, this is something we have had in mind all along.
> The only thing that needs to be worked on is the security model.
> Currently there is no authentication scheme used.  But that is on our
> list of things to do.

There's security and there's also the environment.  That is, some
users will be working together on the same project.  They may want to
have access to some common data, and also have some private workspace
so that they don't step on each other's variables.  Other people may
have only private data and want to pretend that there are no other
users of the system.

One thing that was a bit of a disappointment to me was that with the
RemoteController I have to give something a name to be able to get the
value back.  I'd like to do something like:

retval = rc.executeAll('somefunc(somedata)')
print retval['value']   # This is whatever somefunc returned.

But in fact i have to do:

rc.executeAll('retval = somefunc(somedata)')
print rc['retval']

That's the reason I was poking around in the ipython code--I wanted to
figure out how to get 'value' into the dict returned by rc.execute, in
addition to stdout and stdin.

As far as I was able to see without spending too much time, this is a
problem with python, not with ipython, since the bits of python to
which the code string is passed handle the string a line at a time,
and each line may not be an executable chunk (might be the first line
of a for loop) and not every executable chunk produces a value (might
be a statement, not an expression).

I mention this because once things need to have names to get back to
the controller, there's the possibility of users stepping on each
others names.

Then there's the issue of environment as it relates to code, not data.
 If I load up a bunch of python modules that I'm working on/debugging,
I'm constantly going to be reloading them as I change them.  That's
fine as it goes, but I've definitely gotten myself into situations
where my code was behaving strangely and the easiest thing was to
restart python rather than try to figure out which reload I missed.
If there are other users that'd be impossible.  It'd be nice if there
was something that would give me a clean slate, or delete all the
modules that I've loaded so that I get fresh copies when I import
them.  I'm thinking of some kind of escape hatch where the user can
say "I can't figure it out, start over"

Also people may want the working directory to be different.

Finally, people could do strange things like mess with python's own
modules (changing os.path.sep, for instance) which would throw a
wrench in other peoples' code.

Anyway, this is what I've been thinking about off-and-on for the past
few days.  I offer it as food for thought.

Greg


More information about the IPython-user mailing list