Відмінності між версіями «Python-process-console»

Матеріал з Wiki Welard
Перейти до навігації Перейти до пошуку
(Створена сторінка: '''python: is it possible to attach a console into a running process''' [http://stackoverflow.com/questions/4163964/python-is-it-possible-to-attach-a-console-in...)
 
 
Рядок 1: Рядок 1:
−
'''python: is it possible to attach a console into a running process'''
+
* [http://stackoverflow.com/questions/4163964/python-is-it-possible-to-attach-a-console-into-a-running-process python: is it possible to attach a console into a running process]  
−
[http://stackoverflow.com/questions/4163964/python-is-it-possible-to-attach-a-console-into-a-running-process ]  
 
  
−
Debugging a running python process by interrupting and providing an interactive prompt (Python recipe)
+
* [http://code.activestate.com/recipes/576515/ Debugging a running python process by interrupting and providing an interactive prompt (Python recipe)]  
−
[http://code.activestate.com/recipes/576515/ ]  
 
  
 
Another implementation of roughly the same concept is provided by rconsole. From the documentation:
 
Another implementation of roughly the same concept is provided by rconsole. From the documentation:

Поточна версія на 22:37, 12 березня 2015

Another implementation of roughly the same concept is provided by rconsole. From the documentation:

rconsole is a remote Python console with auto completion, which can be used to inspect and modify the namespace of a running script.

To invoke in a script do:

from rfoo.utils import rconsole
rconsole.spawn_server()

To attach from a shell do:

$ rconsole

Security note: The rconsole listener started with spawn_server() will accept any local connection and may therefore be insecure to use in shared hosting or similar environments!