[web2py] Re: redirecting python console output to web browser page

2012-01-10 Thread Ross Peoples
Two things: First, the my_script.py is the program you want to run to get output from. I just used a Python script as an example. This line could just as easily be: output, error = run_command('ls', '-l') to list all files in a directory (though you would typically use Python's os module for

[web2py] Re: redirecting python console output to web browser page

2012-01-09 Thread blackshirt
like hard to implement.. i want simple approach for them On Jan 3, 3:17 am, Paolo Caruccio paolo.carucci...@gmail.com wrote: There is another HTML5 technology to push stream from server to client : EventSource aka Sent-Server Events (http://dev.w3.org/html5/eventsource/). Its behaviour is like

[web2py] Re: redirecting python console output to web browser page

2012-01-09 Thread blackshirt
i'm still pretty newbie for them.. but i'll try to search. On Jan 2, 11:42 pm, Ross Peoples ross.peop...@gmail.com wrote: Yes, you can, though it's much more difficult to stream it live to a web page. You would need to use JavaScript (comet or polling) to get the output as it is generated and

[web2py] Re: redirecting python console output to web browser page

2012-01-09 Thread blackshirt
Ross, i think i don't want to use external script, like my_script.py ... On Jan 2, 12:20 am, Ross Peoples ross.peop...@gmail.com wrote: I use subprocess.Popen a lot to run shell commands from Python. There is no need for a specific web2py feature. This is the method I use whenever I need to

[web2py] Re: redirecting python console output to web browser page

2012-01-02 Thread Ross Peoples
Yes, you can, though it's much more difficult to stream it live to a web page. You would need to use JavaScript (comet or polling) to get the output as it is generated and display it in the browser. There are many ways to do this, but it's not the simplest thing in the world. Off the top of my

[web2py] Re: redirecting python console output to web browser page

2012-01-02 Thread Paolo Caruccio
There is another HTML5 technology to push stream from server to client : EventSource aka Sent-Server Events (http://dev.w3.org/html5/eventsource/). Its behaviour is like ajax long polling. I'm - just now - experimenting a simple mechanism to send to clients a message when the database changes.

[web2py] Re: redirecting python console output to web browser page

2012-01-01 Thread blackshirt
Thank's Alan that was very inspiring for noob like me.. if we look at http://groups.google.com/group/web2py/browse_thread/thread/bea1afc64dcc39a6/280bbdcf5acd0bbd#280bbdcf5acd0bbd ,can we use similar methods to do real time streaming output ?? On Dec 30 2011, 6:29 pm, Alan Etkin

[web2py] Re: redirecting python console output to web browser page

2012-01-01 Thread blackshirt
Thank's massimo.. look's very complex to do.. Massimo, is there web2py feature's for doing this ? On Dec 30 2011, 11:29 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: There are two ways around it: - hopefully the apt module can be configured to send output to a file - if not, use the

[web2py] Re: redirecting python console output to web browser page

2012-01-01 Thread Ross Peoples
I use subprocess.Popen a lot to run shell commands from Python. There is no need for a specific web2py feature. This is the method I use whenever I need to call something: import subprocess def run_command(self, *args): Returns the output of a command as a tuple

[web2py] Re: redirecting python console output to web browser page

2012-01-01 Thread blackshirt
Okey Ross, if we using popen, can we doing it for real time (i mean, streaming output) ? On Jan 2, 12:20 am, Ross Peoples ross.peop...@gmail.com wrote: I use subprocess.Popen a lot to run shell commands from Python. There is no need for a specific web2py feature. This is the method I use

[web2py] Re: redirecting python console output to web browser page

2011-12-30 Thread Alan Etkin
I am not sure if web2py has a feature for that. You can still redirect output to a filelike object during controller processing and on exit return the control to the original handler. That way you could extract the output from the file object to append it to the web2py response Pseudo-code: on

[web2py] Re: redirecting python console output to web browser page

2011-12-30 Thread Massimo Di Pierro
There are two ways around it: - hopefully the apt module can be configured to send output to a file - if not, use the python subprocess module to run the code is a separate process. The popen function has the ability to capture the output. On Dec 29, 9:21 pm, blackshirt fatkhulmusli...@gmail.com