[IPython-dev] shell command for ipython1 frontend

Laurent Dufrechou laurent.dufrechou at gmail.com
Sat Aug 30 17:47:10 EDT 2008


Hi gael,

 

import os

import locale

        

def system_call(self, command_string):

        ########## dirty quick hack J specific for windows patform
#############

        sp = command_string.split(' ')

        if sp[0] == 'ls':

            sp[0]='dir'

            command_string = ''.join([word+' ' for word in sp])

        ##############################################

        

        stdin, stdout = os.popen4(command_string)

        result =
stdout.read().decode('cp437').encode(locale.getpreferredencoding())

        #"\x01\x1b[1;36m\x02" <-- add colour to the text...

        self.buffered_write("\x01\x1b[1;36m\x02"+result)

        self._buffer_flush(event=None)

        stdout.close()

        stdin.close()

 

Seems to work better here under vista.(works on linux et osx) This is the
code I use in my frontend.

The code inside ############# is a quick workaround on top of my original
code because seems ipython0 handled the things for me J

So need more work bt seems to work faster and avoid the sleep(.1)

 

Willing to use it?

 

Laurent

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20080830/f1e2855b/attachment.html>


More information about the IPython-dev mailing list