John E. Conlon | 2 May 21:44

Directory not found

I installed ipython from root with

easy_install ipython

When I startup ipython I get.

Installation error. IPython's directory was not found.

Check the following:

The ipython/IPython directory should be in a directory belonging to your
PYTHONPATH environment variable (that is, it should be in a directory
belonging to sys.path). You can copy it explicitly there or just link to it.

Not sure where or what directory ipython/IPython is.  My sys.path looks like
In [2]: sys.path
Out[2]:
['',
 '/usr/bin',
 '/usr/lib/python2.3/site-packages/setuptools-0.6c6-py2.3.egg',
 '/usr/lib/python2.3/site-packages/TracXMLRPC-0.1-py2.3.egg',
 '/usr/lib/python2.3/site-packages/ipython-0.8.2-py2.3.egg',
 '/usr/lib/python2.3/site-packages/netsnmp_python-1.0a1-py2.3-linux-i686.egg',
 '/usr/lib/python23.zip',
 '/usr/lib/python2.3',
 '/usr/lib/python2.3/plat-linux2',
 '/usr/lib/python2.3/lib-tk',
 '/usr/lib/python2.3/lib-dynload',
 '/usr/lib/python2.3/site-packages',
 '/usr/lib/python2.3/site-packages/gtk-2.0',
(Continue reading)

Ville M. Vainio | 3 May 09:58
Picon
Gravatar

Re: Directory not found

On Fri, May 2, 2008 at 10:44 PM, John E. Conlon <jconlon <at> verticon.com> wrote:

>  Not sure where or what directory ipython/IPython is.  My sys.path looks like

I now have ubuntu hardy installed, and I can reproduce this. I'll try to fix it.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Ville M. Vainio | 3 May 11:26
Picon
Gravatar

Re: Directory not found

On Fri, May 2, 2008 at 10:44 PM, John E. Conlon <jconlon <at> verticon.com> wrote:

> I installed ipython from root with
>
>  easy_install ipython
>
>
>  When I startup ipython I get.
>
>  Installation error. IPython's directory was not found.

I now have a fix for this - I changed setup.py to use package_data
that is supported in setuptools and distutils as of python 2.4. I
didn't commit it (or upload to PyPi) yet, though, since we have to be
certain that python 2.3 installation without setuptools works
properly...

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Reckoner | 5 May 15:53
Picon

meta keys on windows with ipython?

All the ctrl- bindings work w/ ipython and windows for me, but I can't get the meta-key bindings to work. Meta is usually the same as ALT for windows, but I'm hitting every ALT key on my keyboard and I can't get the ipythonrc.ini bindings that use META to work.

little help?

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
John E. Conlon | 4 May 21:49

Re: Directory not found

Hi Ville,
I will await your further update.

thanks for looking into this,
John

Ville M. Vainio wrote:
> On Fri, May 2, 2008 at 10:44 PM, John E. Conlon <jconlon <at> verticon.com> wrote:
>
>   
>> I installed ipython from root with
>>
>>  easy_install ipython
>>
>>
>>  When I startup ipython I get.
>>
>>  Installation error. IPython's directory was not found.
>>     
>
> I now have a fix for this - I changed setup.py to use package_data
> that is supported in setuptools and distutils as of python 2.4. I
> didn't commit it (or upload to PyPi) yet, though, since we have to be
> certain that python 2.3 installation without setuptools works
> properly...
>
>   
Patrik Jonsson | 7 May 07:29
Favicon

Running ipython within NTemacs

Hi all,

I've been using ipython for a while, and just decided that it would be nice to have it working from within emacs on my windows machine. Here's my setup

python 2.5
ipython 0.8.2 (with readline etc)
NTemacs 22.0.92.1
python-mode.el v 465

I've created a .bat file which starts ipython with the ipython script, and this works from outside emacs. However, if I start emacs and do "py-shell", ipython crashes. I've attached the crash report. My .emacs says:

; ipython
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
                   interpreter-mode-alist))
(autoload 'python-mode "c:\\software\\ntemacs22\\site-lisp\\python-mode\\python-mode" "Python editing mode." t)
(setq ipython-command "c:\\python25\\ipython.bat")
(require 'ipython)

Is this supposed to work, or can anyone say something obvious I'm doing wrong? The documentation doesn't seem to specifically address the emacs+windows+ipython trifecta.

Thanks,

/Patrik

***************************************************************************

IPython post-mortem report

IPython version: 0.8.2 

SVN revision   : 2876M 

Platform info  : os.name -> nt, sys.platform -> win32

***************************************************************************

Current user configuration structure:

{'Version': 0,
 '__allownew': True,
 'alias': [],
 'args': [],
 'autocall': 1,
 'autoedit_syntax': 0,
 'autoindent': 1,
 'automagic': 1,
 'banner': 1,
 'c': '',
 'cache_size': 1000,
 'classic': 0,
 'color_info': 1,
 'colors': 'Linux',
 'confirm_exit': 1,
 'debug': 0,
 'deep_reload': 0,
 'editor': 'notepad',
 'embedded': False,
 'execfile': [],
 'execute': [''],
 'gthread': 0,
 'help': 0,
 'import_all': [],
 'import_mod': [],
 'import_some': [[]],
 'include': [],
 'interact': 1,
 'ipythondir': 'C:\\Documents and Settings\\patrik\\My Documents\\_ipython',
 'log': 0,
 'logfile': '',
 'logplay': '',
 'magic_docstrings': 0,
 'messages': 1,
 'multi_line_specials': 1,
 'nosep': 0,
 'object_info_string_level': 0,
 'opts': Struct({'__allownew': True}),
 'pdb': 0,
 'pprint': 1,
 'profile': '',
 'prompt_in1': 'In [\\#]: ',
 'prompt_in2': '   .\\D.: ',
 'prompt_out': 'Out[\\#]: ',
 'prompts_pad_left': 1,
 'pylab': 0,
 'pylab_import_all': 1,
 'q4thread': 0,
 'qthread': 0,
 'quick': 0,
 'quiet': 0,
 'rcfile': 'ipythonrc.ini',
 'readline': 1,
 'readline_merge_completions': 1,
 'readline_omit__names': 0,
 'readline_parse_and_bind': ['tab: complete',
                             '"\\C-l": possible-completions',
                             'set show-all-if-ambiguous on',
                             '"\\C-o": tab-insert',
                             '"\\M-i": "    "',
                             '"\\M-o": "\\d\\d\\d\\d"',
                             '"\\M-I": "\\d\\d\\d\\d"',
                             '"\\C-r": reverse-search-history',
                             '"\\C-s": forward-search-history',
                             '"\\C-p": history-search-backward',
                             '"\\C-n": history-search-forward',
                             '"\\e[A": history-search-backward',
                             '"\\e[B": history-search-forward',
                             '"\\C-k": kill-line',
                             '"\\C-u": unix-line-discard'],
 'readline_remove_delims': '-/~',
 'screen_length': -2,
 'separate_in': '\n',
 'separate_out': '',
 'separate_out2': '',
 'system_header': 'IPython system call: ',
 'system_verbose': 0,
 'term_title': 1,
 'tk': 0,
 'upgrade': 0,
 'wildcards_case_sensitive': 1,
 'wthread': 0,
 'wxversion': '0',
 'xmode': 'Context'}

***************************************************************************

Crash traceback:

---------------------------------------------------------------------------
TypeError                              Python 2.5.1: C:\Python25\python.exe
                                                   Tue May 06 22:26:51 2008
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.

C:\Python25\scripts\ipython in <module>()
     12 IPython.Shell.IPShell().mainloop(sys_exit=1)
     13 
     14 [or simply IPython.Shell.IPShell().mainloop(1) ]
     15 
     16 and IPython will be your working environment when you start python. The final
     17 sys.exit() call will make python exit transparently when IPython finishes, so
     18 you don't have an extra prompt to get out of.
     19 
     20 This is probably useful to developers who manage multiple Python versions and
     21 don't want to have correspondingly multiple IPython versions. Note that in
     22 this mode, there is no way to pass IPython any command-line options, as those
     23 are trapped first by Python itself.
     24 """
     25 
     26 import IPython
---> 27 IPython.Shell.start().mainloop()
        global IPython.Shell.start.mainloop = undefined
     28 
     29 
     30 
     31 
     32 
     33 
     34 
     35 
     36 
     37 
     38 
     39 
     40 
     41 
     42 

C:\Python25\lib\site-packages\IPython\Shell.py in start(user_ns=None)
   1137         arg1 = argv[1]
   1138         if arg1.endswith('-gthread'):
   1139             shell = IPShellGTK
   1140         elif arg1.endswith( '-qthread' ):
   1141             shell = IPShellQt
   1142         elif arg1.endswith( '-q4thread' ):
   1143             shell = IPShellQt4
   1144         elif arg1.endswith('-wthread'):
   1145             shell = IPShellWX
   1146         elif arg1.endswith('-pylab'):
   1147             shell = _matplotlib_shell_class()
   1148         else:
   1149             shell = IPShell
   1150     else:
   1151         shell = IPShell
-> 1152     return shell(user_ns = user_ns)
        shell = <class IPython.Shell.IPShell at 0x00EF2C60>
        user_ns = None
   1153 
   1154 # Some aliases for backwards compatibility
   1155 IPythonShell = IPShell
   1156 IPythonShellEmbed = IPShellEmbed
   1157 #************************ End of file <Shell.py> ***************************
   1158 
   1159 
   1160 
   1161 
   1162 
   1163 
   1164 
   1165 
   1166 
   1167 

C:\Python25\lib\site-packages\IPython\Shell.py in __init__(self=<IPython.Shell.IPShell
instance at 0x00A9A5A8>, argv=None, user_ns=None, user_global_ns=None, debug=1,
shell_class=<class 'IPython.iplib.InteractiveShell'>)
     59 # Tag when runcode() is active, for exception handling
     60 CODE_RUN = None
     61 
     62 #-----------------------------------------------------------------------------
     63 # This class is trivial now, but I want to have it in to publish a clean
     64 # interface. Later when the internals are reorganized, code that uses this
     65 # shouldn't have to change.
     66 
     67 class IPShell:
     68     """Create an IPython instance."""
     69     
     70     def __init__(self,argv=None,user_ns=None,user_global_ns=None,
     71                  debug=1,shell_class=InteractiveShell):
     72         self.IP = make_IPython(argv,user_ns=user_ns,
     73                                user_global_ns=user_global_ns,
---> 74                                debug=debug,shell_class=shell_class)
        debug = 1
        shell_class = <class 'IPython.iplib.InteractiveShell'>
     75 
     76     def mainloop(self,sys_exit=0,banner=None):
     77         self.IP.mainloop(banner)
     78         if sys_exit:
     79             sys.exit()
     80 
     81 #-----------------------------------------------------------------------------
     82 def kill_embedded(self,parameter_s=''):
     83     """%kill_embedded : deactivate for good the current embedded IPython.
     84 
     85     This function (after asking for confirmation) sets an internal flag so that
     86     an embedded IPython will never activate again.  This is useful to
     87     permanently disable a shell that is being called inside a loop: once you've
     88     figured out what you needed from it, you may then kill it and the program
     89     will then continue to run without the interactive shell interfering again.

C:\Python25\lib\site-packages\IPython\ipmaker.py in
make_IPython(argv=[r'C:\Python25\scripts\ipython'], user_ns=None, user_global_ns=None,
debug=1, rc_override=None, shell_class=<class 'IPython.iplib.InteractiveShell'>,
embedded=False, **kw={})
    745         IP_rc.banner = 0
    746     if IP_rc.banner:
    747         BANN_P = IP.BANNER_PARTS
    748     else:
    749         BANN_P = []
    750 
    751     if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
    752 
    753     # add message log (possibly empty)
    754     if msg.summary: BANN_P.append(msg.summary)
    755     # Final banner is a string
    756     IP.BANNER = '\n'.join(BANN_P)
    757 
    758     # Finalize the IPython instance.  This assumes the rc structure is fully
    759     # in place.
--> 760     IP.post_config_initialization()
        IP.post_config_initialization = <bound method InteractiveShell.post_config_initialization of
<IPython.iplib.InteractiveShell object at 0x00A99A70>>
    761 
    762     return IP
    763 #************************ end of file <ipmaker.py> **************************
    764 
    765 
    766 
    767 
    768 
    769 
    770 
    771 
    772 
    773 
    774 
    775 

C:\Python25\lib\site-packages\IPython\iplib.py in
post_config_initialization(self=<IPython.iplib.InteractiveShell object at 0x00A99A70>)
    650         This is called after the configuration files have been processed to
    651         'finalize' the initialization."""
    652 
    653         rc = self.rc
    654 
    655         # Object inspector
    656         self.inspector = OInspect.Inspector(OInspect.InspectColors,
    657                                             PyColorize.ANSICodeColors,
    658                                             'NoColor',
    659                                             rc.object_info_string_level)
    660         
    661         self.rl_next_input = None
    662         self.rl_do_indent = False
    663         # Load readline proper
    664         if rc.readline:
--> 665             self.init_readline()
        self.init_readline = <bound method InteractiveShell.init_readline of
<IPython.iplib.InteractiveShell object at 0x00A99A70>>
    666 
    667         
    668         # local shortcut, this is used a LOT
    669         self.log = self.logger.log
    670 
    671         # Initialize cache, set in/out prompts and printing system
    672         self.outputcache = CachedOutput(self,
    673                                         rc.cache_size,
    674                                         rc.pprint,
    675                                         input_sep = rc.separate_in,
    676                                         output_sep = rc.separate_out,
    677                                         output_sep2 = rc.separate_out2,
    678                                         ps1 = rc.prompt_in1,
    679                                         ps2 = rc.prompt_in2,
    680                                         ps_out = rc.prompt_out,

C:\Python25\lib\site-packages\IPython\iplib.py in
init_readline(self=<IPython.iplib.InteractiveShell object at 0x00A99A70>)
   1348             # is being used (as on Leopard) the readline config is
   1349             # not run as the syntax for libedit is different.
   1350             if not readline.uses_libedit:
   1351                 for rlcommand in self.rc.readline_parse_and_bind:
   1352                     readline.parse_and_bind(rlcommand)
   1353 
   1354             # remove some chars from the delimiters list
   1355             delims = readline.get_completer_delims()
   1356             delims = delims.translate(string._idmap,
   1357                                       self.rc.readline_remove_delims)
   1358             readline.set_completer_delims(delims)
   1359             # otherwise we end up with a monster history after a while:
   1360             readline.set_history_length(1000)
   1361             try:
   1362                 #print '*** Reading readline history'  # dbg
-> 1363                 readline.read_history_file(self.histfile)
        readline.read_history_file = <bound method Readline.read_history_file of
<pyreadline.rlmain.Readline object at 0x00DE0B50>>
        self.histfile = 'C:\\Documents and Settings\\patrik\\My Documents\\_ipython\\history'
   1364             except IOError:
   1365                 pass  # It doesn't exist yet.
   1366 
   1367             atexit.register(self.atexit_operations)
   1368             del atexit
   1369 
   1370         # Configure auto-indent for all platforms
   1371         self.set_autoindent(self.rc.autoindent)
   1372 
   1373     def ask_yes_no(self,prompt,default=True):
   1374         if self.rc.quiet:
   1375             return True
   1376         return ask_yes_no(prompt,default)
   1377     
   1378     def _should_recompile(self,e):

C:\Python25\lib\site-packages\pyreadline\rlmain.py in
read_history_file(self=<pyreadline.rlmain.Readline object at 0x00DE0B50>,
filename=r'C:\Documents and Settings\patrik\My Documents\_ipython\history')
    168 
    169     def set_history_length(self, length): 
    170         '''Set the number of lines to save in the history file.
    171 
    172         write_history_file() uses this value to truncate the history file
    173         when saving. Negative values imply unlimited history file size.
    174         '''
    175         self._history.set_history_length(length)
    176 
    177     def clear_history(self):
    178         '''Clear readline history'''
    179         self._history.clear_history()
    180 
    181     def read_history_file(self, filename=None): 
    182         '''Load a readline history file. The default filename is ~/.history.'''
--> 183         self._history.read_history_file(filename)
        self._history.read_history_file = <bound method LineHistory.read_history_file of
<pyreadline.lineeditor.history.LineHistory object at 0x00DE0C90>>
        filename = 'C:\\Documents and Settings\\patrik\\My Documents\\_ipython\\history'
    184 
    185     def write_history_file(self, filename=None): 
    186         '''Save a readline history file. The default filename is ~/.history.'''
    187         self._history.write_history_file(filename)
    188 
    189     #Completer functions
    190 
    191     def set_completer(self, function=None): 
    192         '''Set or remove the completer function.
    193 
    194         If function is specified, it will be used as the new completer
    195         function; if omitted or None, any completer function already
    196         installed is removed. The completer function is called as
    197         function(text, state), for state in 0, 1, 2, ..., until it returns a
    198         non-string value. It should return the next possible completion

C:\Python25\lib\site-packages\pyreadline\lineeditor\history.py in
read_history_file(self=<pyreadline.lineeditor.history.LineHistory object at 0x00DE0C90>,
filename=r'C:\Documents and Settings\patrik\My Documents\_ipython\history')
     55         
     56     history_length=property(get_history_length,set_history_length)
     57     history_cursor=property(get_history_cursor,set_history_cursor)
     58 
     59     def clear_history(self):
     60         '''Clear readline history.'''
     61         self.history[:] = []
     62         self.history_cursor = 0
     63 
     64     def read_history_file(self, filename=None): 
     65         '''Load a readline history file.'''
     66         if filename is None:
     67             filename=self.history_filename
     68         try:
     69             for line in open(filename, 'r'):
---> 70                 self.add_history(lineobj.ReadLineTextBuffer(ensure_unicode(line.rstrip())))
        self.add_history = <bound method LineHistory.add_history of
<pyreadline.lineeditor.history.LineHistory object at 0x00DE0C90>>
        global lineobj.ReadLineTextBuffer = <class 'pyreadline.lineeditor.lineobj.ReadLineTextBuffer'>
        global ensure_unicode = <function ensure_unicode at 0x00C124B0>
        line.rstrip = <built-in method rstrip of str object at 0x00F49DA0>
     71         except IOError:
     72             self.history = []
     73             self.history_cursor = 0
     74 
     75     def write_history_file(self, filename=None): 
     76         '''Save a readline history file.'''
     77         if filename is None:
     78             filename=self.history_filename
     79         fp = open(filename, 'wb')
     80         for line in self.history[-self.history_length:]:
     81             fp.write(ensure_str(line.get_line_text()))
     82             fp.write('\n')
     83         fp.close()
     84 
     85 

C:\Python25\lib\site-packages\pyreadline\unicode_helper.py in ensure_unicode(text='ls')
      5 #  Distributed under the terms of the BSD License.  The full license is in
      6 #  the file COPYING, distributed as part of this software.
      7 #*****************************************************************************
      8 import sys
      9 
     10 try:
     11     pyreadline_codepage=sys.stdout.encoding
     12 except AttributeError:        #This error occurs when pdb imports readline and doctest has replaced 
     13                               #stdout with stdout collector
     14     pyreadline_codepage="ascii"   #assume ascii codepage
     15     
     16 
     17 def ensure_unicode(text):
     18     """helper to ensure that text passed to WriteConsoleW is unicode"""
     19     if isinstance(text, str):
---> 20         return text.decode(pyreadline_codepage, "replace")
        text.decode = <built-in method decode of str object at 0x00F498A0>
        global pyreadline_codepage = None
     21     return text
     22 
     23 def ensure_str(text):
     24     """Convert unicode to str using pyreadline_codepage"""
     25     if isinstance(text, unicode):
     26         return text.encode(pyreadline_codepage, "replace")
     27     return text
     28 
     29 
     30 
     31 
     32 
     33 
     34 
     35 

TypeError: decode() argument 1 must be string, not None

***************************************************************************

History of session input:

*** Last line of input (may not be in above history):
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Ville M. Vainio | 7 May 09:18
Picon
Gravatar

Re: Running ipython within NTemacs

On Wed, May 7, 2008 at 8:29 AM, Patrik Jonsson <patrik <at> ucolick.org> wrote:

> Is this supposed to work, or can anyone say something obvious I'm doing

I can't tell whether it's "supposed to work", I've had problems with
the same trifecta as well.

However, you might want to try with latest pyreadline from svn, I
think a bug has been fixed there that should prevent the "encoding is
None" problem.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Brian Granger | 7 May 20:47
Picon

Re: IPython1 and TaskClient

Alberto,

I just commited a new example asyntask1.py in ipython1/docs/examples
in the ipython1-dev bzr repo at launchpad:

http://bazaar.launchpad.net/~ipython/ipython/ipython1-dev/revision/32

Have a look at this and see if that helps you get started.  Sorry
about the long delay on this.

Also, because the asynclient uses twisted directly, I would high
recommend (if you haven't already) learning about twisted before
tackling this stuff.

Cheers,

Brian

On Thu, Apr 10, 2008 at 3:35 AM, Alberto Mesas <amesas <at> e-commfactory.com> wrote:
> Thnx for the info! :)
>
>  I have been reading asynmultiengine1.py, but I got stuck.
>
>  from twisted.internet import reactor, defer
>  from ipython1.kernel import asynclient
>
>  client = asynclient.AsynTaskClient(('localhost', 10105))
>
>  def printer(r):
>     print r
>     return r
>
>
>  d = asynclient.AsynTask("a = %i"%n, pull="a")
>  #d = client.push(dict(a=5, b='asdf', c=[1,2,3]),targets=0,block=True)
>
>  d.addCallback(lambda _: client.pull(('a','b','c'),targets=0,block=True))
>  d.addBoth(printer)
>  d.addCallback(lambda _: reactor.stop())
>  reactor.run()
>
>
>
>  I'm sure I'm missing something, but can't get it :D
>
>  How I should rewrite the push/pull part?
>
>  BTW I have been testing my little app using SyncMode and a eight core
>  server and it worked flawlessly!!! Today I want to test using 8
>  servers and if it works and I can move it to Async, I will be ready to
>  setup it production environment :)
>
>  It just works!
>
>
>
>
>  On Thu, Apr 10, 2008 at 12:08 AM, Brian Granger <ellisonbg.net <at> gmail.com> wrote:
>  > > Newbie, just reading some doc :)
>  >  >
>  >  > Is it possible to pass functions to a TaskClient? I see it can be passed to
>  >  > an Engine, but I see no reference to it in the Task docs.
>  >
>  >  The way to do this is to also create a MultiEngineClient and use the
>  >  push_function method.  The key point is that you can use both the
>  >  TaskCliet and MultiEngineClient together and they talk to the same set
>  >  of engines underneath.  Thus, any functions you push using
>  >  MultiEngineClient will be available to code running in tasks (unless
>  >  you set the clearBefore or clearAfter flags in your Taks).
>  >
>  >  > And is there a way to setup some type of callback for a "finished" task? Or
>  >  > the only way to know the completed ones it to check queue_status?
>  >
>  >  There are two ways to accomplish this:
>  >
>  >  1) If you are using the standard client module
>  >  (ipython1.kernel.client) the TaskClient has a get_task_result method
>  >  that has the following signature:
>  >
>  >  get_task_result(self, taskid, block=False):
>  >
>  >  If you set block=True, this call will wait until the task finishes and
>  >  then return its result.
>  >
>  >  You can also wait for a set of tasks to be completed by using the
>  >  barrier method:
>  >
>  >  barrier(self, taskids)
>  >
>  >  here, taskids is simply a list or tuple of task ids.
>  >
>  >  2) If you really want a more event/callback driven interface, you can
>  >  use the asynclient module:
>  >
>  >  ipython1.kernel.asynclient
>  >
>  >  This has an AsynTaskClient that is designed to be used with Twisted's
>  >  even loop running.  Then all the methods return deferreds that you can
>  >  use the register callbacks on.
>  >
>  >  Here is an example of that:
>  >
>  >  docs/examples/asynmultiengine1.py
>  >
>  >  (OK, this is not an example of the Task stuff, but you will get the idea)..
>  >
>  >  Let us know if you have other questions.
>  >
>  >  Brian
>  >
>  >  > Thnx in advance for the info, and sorry if those are basic questions, just
>  >  > read some doc for evaluating IPython1 as the right  tool :)
>  >  >
>  >  > _______________________________________________
>  >  >  IPython-user mailing list
>  >  >  IPython-user <at> scipy.org
>  >  >  http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
>  >  >
>  >  >
>  >
>
Brian Granger | 7 May 20:48
Picon

Re: IPython1 and TaskClient

> I developed my app using sync mode, it solved my problem!!!! I scaled out
> very easily! :D

Great

> Now I need just to finish the logging part and I would like to move
> everything to async mode.

What exactly do you mean by logging?

> So yes, I'm still stuck ( I must be honest and say that I didn't googled /
> read a lot trying to figure out how to move everything to async mode)
>
> BTW, is it a good idea to implement syslog logging on engine, to log it
> everything to a "central server"?

Can you give more info about what you mean by this?

Thanks

Brian

> My plan was to log to a local file per engine, and at the same time to a
> central server using syslog, but I still have to check what happens if
> syslog server dies.
>
>
>
> On Wed, Apr 23, 2008 at 8:22 PM, Brian Granger <ellisonbg.net <at> gmail.com>
> wrote:
>
> > Alberto,
> >
> > Sorry, I never got back to you on this.  Did you ever figure things
> > out.  Let me know - I have some time now and could help you get going
> > if you are still stuck.
> >
> > Brian
> >
> >
> >
> >
> > On Thu, Apr 10, 2008 at 3:35 AM, Alberto Mesas <amesas <at> e-commfactory.com>
> wrote:
> > > Thnx for the info! :)
> > >
> > >  I have been reading asynmultiengine1.py, but I got stuck.
> > >
> > >  from twisted.internet import reactor, defer
> > >  from ipython1.kernel import asynclient
> > >
> > >  client = asynclient.AsynTaskClient(('localhost', 10105))
> > >
> > >  def printer(r):
> > >     print r
> > >     return r
> > >
> > >
> > >  d = asynclient.AsynTask("a = %i"%n, pull="a")
> > >  #d = client.push(dict(a=5, b='asdf', c=[1,2,3]),targets=0,block=True)
> > >
> > >  d.addCallback(lambda _:
> client.pull(('a','b','c'),targets=0,block=True))
> > >  d.addBoth(printer)
> > >  d.addCallback(lambda _: reactor.stop())
> > >  reactor.run()
> > >
> > >
> > >
> > >  I'm sure I'm missing something, but can't get it :D
> > >
> > >  How I should rewrite the push/pull part?
> > >
> > >  BTW I have been testing my little app using SyncMode and a eight core
> > >  server and it worked flawlessly!!! Today I want to test using 8
> > >  servers and if it works and I can move it to Async, I will be ready to
> > >  setup it production environment :)
> > >
> > >  It just works!
> > >
> > >
> > >
> > >
> > >  On Thu, Apr 10, 2008 at 12:08 AM, Brian Granger
> <ellisonbg.net <at> gmail.com> wrote:
> > >  > > Newbie, just reading some doc :)
> > >  >  >
> > >  >  > Is it possible to pass functions to a TaskClient? I see it can be
> passed to
> > >  >  > an Engine, but I see no reference to it in the Task docs.
> > >  >
> > >  >  The way to do this is to also create a MultiEngineClient and use the
> > >  >  push_function method.  The key point is that you can use both the
> > >  >  TaskCliet and MultiEngineClient together and they talk to the same
> set
> > >  >  of engines underneath.  Thus, any functions you push using
> > >  >  MultiEngineClient will be available to code running in tasks (unless
> > >  >  you set the clearBefore or clearAfter flags in your Taks).
> > >  >
> > >  >  > And is there a way to setup some type of callback for a "finished"
> task? Or
> > >  >  > the only way to know the completed ones it to check queue_status?
> > >  >
> > >  >  There are two ways to accomplish this:
> > >  >
> > >  >  1) If you are using the standard client module
> > >  >  (ipython1.kernel.client) the TaskClient has a get_task_result method
> > >  >  that has the following signature:
> > >  >
> > >  >  get_task_result(self, taskid, block=False):
> > >  >
> > >  >  If you set block=True, this call will wait until the task finishes
> and
> > >  >  then return its result.
> > >  >
> > >  >  You can also wait for a set of tasks to be completed by using the
> > >  >  barrier method:
> > >  >
> > >  >  barrier(self, taskids)
> > >  >
> > >  >  here, taskids is simply a list or tuple of task ids.
> > >  >
> > >  >  2) If you really want a more event/callback driven interface, you
> can
> > >  >  use the asynclient module:
> > >  >
> > >  >  ipython1.kernel.asynclient
> > >  >
> > >  >  This has an AsynTaskClient that is designed to be used with
> Twisted's
> > >  >  even loop running.  Then all the methods return deferreds that you
> can
> > >  >  use the register callbacks on.
> > >  >
> > >  >  Here is an example of that:
> > >  >
> > >  >  docs/examples/asynmultiengine1.py
> > >  >
> > >  >  (OK, this is not an example of the Task stuff, but you will get the
> idea)..
> > >  >
> > >  >  Let us know if you have other questions.
> > >  >
> > >  >  Brian
> > >  >
> > >  >  > Thnx in advance for the info, and sorry if those are basic
> questions, just
> > >  >  > read some doc for evaluating IPython1 as the right  tool :)
> > >  >  >
> > >  >  > _______________________________________________
> > >  >  >  IPython-user mailing list
> > >  >  >  IPython-user <at> scipy.org
> > >  >  >  http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
> > >  >  >
> > >  >  >
> > >  >
> > >
> >
>
>
fred | 7 May 22:11
Picon

Re: startup file

Ville M. Vainio a écrit :
> On Mon, Apr 28, 2008 at 6:38 PM, fred <fredmfp <at> gmail.com> wrote:
> 
>>  sys.displayhook = display_init
> 
> The deal is that you can't set sys.displayhook in IPython. You need to
> use the exposed result_display hook.
Sorry, but I don't understand.

I wrote in my display_init.py file:

import __builtin__

def result_display(self, arg):
     if arg is None:
         return
     __builtin__._ = None
     print arg
     __builtin__._ = arg

and I import it from my ipythonrc file:
import_mod display_init

But this has no effect.

What am I doing wrong ?

TIA.

Cheers,

--

-- 
Fred

Gmane