[IPython-user] Re: ipython as zope interactive console
Jeff Kowalczyk
jtk at yahoo.com
Tue Oct 5 16:16:50 CDT 2004
Fernando Perez wrote:
>> - Effective user is a bit of a problem. IPython tries to write history,
>> etc. into /root/.ipython/ when it is no longer that (root) user.
>
> I imagine that if the ipython import calls are made once the UID has been
> switched, this should be OK. But a bit more work may be needed here.
>
This is what I see when canceling out of ipython:
Do you really want to exit ([y]/n)? y
Unable to save IPython command history to file: '/root/.ipython/history'
Error in sys.exitfunc:
---------------------------------------------------------------------------
IOError Python 2.3.4: /usr/bin/python
Tue Oct 5 17:13:21 2004
A problem occured executing Python code. Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/usr/lib/python2.3/atexit.py in _run_exitfuncs()
5 One public function, register, is defined.
6 """
7
8 __all__ = ["register"]
9
10 _exithandlers = []
11 def _run_exitfuncs():
12 """run any registered exit functions
13
14 _exithandlers is traversed in reverse order so functions are executed
15 last in, first out.
16 """
17
18 while _exithandlers:
19 func, targs, kargs = _exithandlers.pop()
---> 20 func(*targs, **kargs)
func = <bound method InteractiveShell.atexit_operations of <IPython.iplib.InteractiveShell instance>>, targs = (), kargs = {}
21
22 def register(func, *targs, **kargs):
23 """register a function to be executed upon normal program termination
24
25 func - function to be called at exit
26 targs - optional arguments to pass to func
27 kargs - optional keyword arguments to pass to func
28 """
29 _exithandlers.append((func, targs, kargs))
30
31 import sys
32 if hasattr(sys, "exitfunc"):
33 # Assume it's another registered exit function - append it to our list
34 register(sys.exitfunc)
35 sys.exitfunc = _run_exitfuncs
/usr/lib/python2.3/site-packages/IPython/iplib.py in atexit_operations(self=<IPython.iplib.InteractiveShell instance>)
763 """This will be executed at the time of exit.
764
765 Saving of persistent data should be performed here. """
766
767 # input history
768 self.savehist()
769
770 # Cleanup all tempfiles left around
771 for tfile in self.tempfiles:
772 try:
773 os.unlink(tfile)
774 except OSError:
775 pass
776
777 # save the "persistent data" catch-all dictionary
--> 778 pickle.dump(self.persist, open(self.persist_fname,"w"))
global pickle = <module 'cPickle' from '/usr/lib/python2.3/lib-dynload/cPickle.so'>, global dump = undefined, self = <IPython.iplib.InteractiveShell instance>, global persist = undefined, global open = undefined, global persist_fname = undefined
779
780 def savehist(self):
781 """Save input history to a file (via readline library)."""
782 try:
783 self.readline.write_history_file(self.histfile)
784 except:
785 print 'Unable to save IPython command history to file: ' + \
786 `self.histfile`
787
788 def pre_readline(self):
789 """readline hook to be used at the start of each line.
790
791 Currently it handles auto-indent only."""
792
793 self.readline.insert_text(' '* self.readline_indent)
IOError: [Errno 13] Permission denied: '/root/.ipython/persist'
Could not create crash report on disk.
I don't yet *know* that the console has switched from root to the zope
effective-user, but that's what it looks like.
More information about the IPython-user
mailing list