f



Can I embedding a (python) console on python program?

HI All,

Apologize for being a newbie to python area and sorry for my English.=20

Actually what I need is embedding a python interactive console(or other
shell console alike module) on my python program for debugging and
controlling purpose during the program runtime.=20

For example, print/set some important value, query some runtime status
when I remote login to host via telnet/ssh when the program running on
the host. One of the idea is I can write the program use the GUI tech,
but that is not fit for someone use a text based session.

In summary, in my scheme, it should something looks like the GEdit
extension - python console and but may interactive with tty/vty lines.

Can anyone give a brief to me?=20

Thanks in advance. =20

--=20
Kee K Y CHEN <keekychen@gmail.com>

0
keekychen (3)
2/20/2010 5:38:47 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

1 Replies
932 Views

Similar Articles

[PageSpeed] 57

On 02/20/10 16:38, Kee K Y CHEN wrote:
> HI All,
> 
> Apologize for being a newbie to python area and sorry for my English. 
> 
> Actually what I need is embedding a python interactive console(or other
> shell console alike module) on my python program for debugging and
> controlling purpose during the program runtime. 
> 
> For example, print/set some important value, query some runtime status
> when I remote login to host via telnet/ssh when the program running on
> the host. One of the idea is I can write the program use the GUI tech,
> but that is not fit for someone use a text based session.
> 
> In summary, in my scheme, it should something looks like the GEdit
> extension - python console and but may interactive with tty/vty lines.
> 
> Can anyone give a brief to me? 
> 
> Thanks in advance.  

Look how IDLE and pdb does it. I believe the `cmd` built-in module is
specifically written for this case.
0
lie.1296 (854)
2/20/2010 7:33:30 AM
Reply:

Similar Artilces:

python is a python
python is a python ...

Embedding Python in Python
Hi, I've been programming in Python for a couple of weeks now and am quite impressed with the language - it was very easy to learn (it actually reminds me a lot of programming in BASIC many many years ago - it's very fast to hack together a couple lines of code in interactive mode). I'm throwing together a simple little game (sort of a MUD-type thing) as my first 'big' project, and I thought it would be cool to be able to script the game in Python. Basically, I want to be able to type scripts in from within the game and attach them to objects, monsters, rooms, whatever. N...

Embedding a python console inside a python application
Hi, I am starting an application in which I would like to have some scripting functionality. It will obviously be done in Python. The thing is that I would like my scripts to have access to the rest of the application as an object it could manipulate. I made some research and I found the code module, which allows to have a Python interpreter inside an application, but I am not sure if I can access to the "parent" which created this interpreter. A solution could be to launch my application through an interpreter, but the problem there is how to integrate it back into the GUI, redirec...

Embedding Python in Python #2
Anyone know a good way to embed python within python? Now before you tell me that's silly, let me explain what I'd like to do. I'd like to allow user-defined scriptable objects. I'd like to give them access to modify pieces of my classes. I'd like to disallow access to pretty much the rest of the modules. Any ideas/examples? -Robey You probably want something like this: globalDict = {} exec(stringOfPythonCodeFromUser, globalDict) globalDict is now the global namespace of whatever was in stringOfPythonCodeFromUser, so you can grab values from that and selectivly im...

embedding python in python #3
Hi, anyone had any experiences in embedding python in python? I've tried to do this but it doesn't work. eval("from Tkinter import *") Thanks maurice Use exec. On Wed, Sep 29, 2004 at 09:23:28AM +0000, Maurice LING wrote: > Hi, > > anyone had any experiences in embedding python in python? > > I've tried to do this but it doesn't work. > > eval("from Tkinter import *") Maurice LING <mauriceling@acm.org> wrote in message news:<415a7f0b$1@news.unimelb.edu.au>... > Hi, > > anyone had any experiences in embeddi...

Python mascot? How about a Pythoneer?
I've been thinking that a good Python mascot might help in raising public awareness of Python. The problem with a snake as a mascot is that it is not anthropomorphic enough. An effective mascot has to have something approximating two arms, two legs, and a head, so that he can be put into various interesting situations and adventures. (At the very least, he has to be able to work a keyboard and a mouse!) Good examples can be found in some of the imaginative things that have been done with Linux's Tux. So a snake is out. So are Terry Gilliam's wonderful cartoons for the Flyin...

Invoking Python from Python
Hi all, I have a need to create a Python script on the fly from another Python program and then execute the script so created. Do I need to invoke Python through os.spawnl or is there a better way? Thanks, -- John Am Tue, 08 Nov 2005 08:10:25 -0800 schrieb John Henry: > Hi all, > > I have a need to create a Python script on the fly from another Python > program and then execute the script so created. Do I need to invoke > Python through os.spawnl or is there a better way? Hi, creating source code with a script, is no good solution. Once I had to maintain lisp code w...

Python to Python communication
Hello, I have a group of Python programms which I want to teach to "talk to each other". All run on Windows, on the same computer or in the same intranet. Security of communication is not an issue (encryption on lower level protocols / intra computer communication). Partially these programs are using wxPython. It is important that the communcation is "only an added feature", I am not willing to spend big memory / computing ressources on it. So I googled and came up with at least the following opportunities: XMLRPC - quite "simple" to implement within py...

How to get inputs for a python program that run from another python program
I would like to know how to pass keyboard input for a python script which is ran by another script. for eg: hello1.py: import os if __name__=='__main__': print "I will call this other program called hello.py" os.system("python hello.py") print "hello1.py" hello.py: import os if __name__=='__main__': print "press ENTER to display" #code wer if the user hits enter print "hello" #else the user hits any other keyboard button: sys.exit() now wen i run hello1.py,i want the some func...

Embedded Python
I embed multiple interpreters. I create the interpreter and modules in the primary thread of my application: PyEval_AcquireLock(); thread = Py_NewInterpreter(); PyThreadState_Swap(thread); ....initialize modules, etc.... PyThreadState_Swap(maininterpreter); PyEval_ReleaseLock(); Then I create a C thread called "main" which calls a function called "Main" in the Python interpreter: PyEval_AcquireLock(); PyThreadState_Swap(thread); moduledictionary = PyModule_GetDict(pmodule); PyObject_CallObject(PyDict_GetItemString(moduledictionary, "Main"), NULL); PyThreadSta...

Parsing Python code with a Python Program
Hello, I would like to pass strings to a Python application and have them executed as though they were lines of code. Is 'exec()' the function that I am looking for and/or is there an example of this somewhere? Thanks, Seaweed Hello, I had my quotes wrong is all. EXAMPLE: exec 'print "Hello"' OR: s = 'print "hello"' exec s Thanks anyway, Seaweed pgw wrote: > Hello, > > I would like to pass strings to a Python > application and have them executed as though > they were lines of code. > > Is 'exec()' th...

can a cut-down Python still be Python?
All, Regardless of the technical difficulties involved (and I know they are legion), I am considering developing a very limited subset of Python fit to run on embedded systems using 80188 or 68332 microchips. My main question regarding this is: even if I am successful, would the results be rejected out of hand by y'all as not meeting the Zen of Python? Please advise, The Eternal Squire If you mean missing out some of the libraries then that would be different to missing out core functionality sucjh as generators or list expressions,... In general, if the end task is not to present...

[python] Is there a python written fax program out there?
Hi, Today I was in a meeting and someone mentioned they were looking for some software whereby they could run their own fax server (ie a computer with a modem, someone sends a fax, and the software convertes it to an image and drops it in an email box). I'm posting this here incase someone happens to know of a python implementation or other language implementation that is either free or for sale? If so, I'd like to know where to get them. Thanks David ------- Tracfone: http://cellphone.duneram.com/index.html Cam: http://www.duneram.com/cam/index.html Tax: http://www.duneram.c...

Python embeded in c++ application. Can't load python module if application is placed in folder with unicode chars.
Hello. Please help me to import python module in my application that has python 2.7.2 embeded. I tried example from this link http://docs.python.org/extending/embedding.html#embedding-python-in-c paragraph 5.3. If i place program in folder D:\temp\test_python\test_python=E6vnes p=E5\Debug I will get error - Failed to load "multiply". My localization settings (system language) don't correspond the chars' language used in path. ...

Python loading library containing embedded python...
I have a dll/so which embeds python. I can verify it works by compiling it as an executable and adding an appropriate main. I tried to write unit tests for this library with ctypes and a simple python script. Access violations and other strange things result. I suspect this is because I am basically embedding python in python at this point. How can I make my dll/so with embedded python support use via ctypes? If Py_NewInterpreter is the answer, why does it hang indefinitely? The dll/so must support use in processes which might contain other instances of Python. I can not change that requi...

Embedding Python: Creating Python Class from Application
Hello All, Let's say I have a following python code: class hw_class: def __init__(self): pass def hello_world(self): print 'Hello World!' create_instance('hw_class', 'hw') hw.hello_world() hw = None The 'create_instance' function should be implemented in the application (powered by Delphi - P4D) which is embedding the Python.dll. I am trying to do this for some time having no success. I am missing these informations: 1. How to register global python variable from application which is embedding python? 2. How to assign this variable wi...

How to write python plug-ins for your own python program?
I am writing an audio game using Python. in this game you can apply some sound effects for the clips you have recorded. I want to make this function extensible. I want user to be able to add new sound effect plug-ins in the future. I want the plug-in to be a simple python code (text file) and a description file. I will set some rules for plug-in writing (like you must inherit some class and implement some method). I hope plugin can be added while original program is running. Is there any good method to read in python code and test availability and invoke the functions inside? Thanks Tian ...

Embedded python on systems without python installed
I have python successfully embedded in a program I wrote. What files do I need and where do I need to put them so that it can run on systems that don't have python installed? KillSwitch wrote: > I have python successfully embedded in a program I wrote. > > What files do I need and where do I need to put them so that it can > run on systems that don't have python installed? > I embed python in Delphi apps, and the only thing I add is python24.dll, which I put in the same directory as the Delphi executable, (but i you want a less clean install, you can put the dll als...

Injecting python function in an embedded python engine
Hi All in the list, I've embedded python v2.6.x engine into my application without any problem. Now I would like to inject some additional functions after importing a python module. So, basically I'm importing a python module via PyImport_ImportModule() function. The python module is a simple set of functions and I would check if some functions does exist or not, than if doesn't I would add it from my C application. Checking if a function does exist or not isn't an issue, it works without any problem, my problem is only how to inject a new function in an already imported modul...

real-time monitoring of propriety system: embedding python in C or embedding C in python?
Hi Group, at work, we are thinking to replace some legacy application, which is a hom= e-grown scripting language for monitoring and controlling a large experimen= t. It is able to read live data from sensors, do some simple logic and calc= ulations, send commands to other subsystems and finally generate some new s= ignals. The way it is implemented is that it gets a chunk of 1 second of da= ta (thousands of signals at sample rates from 1Hz to several kHz), does som= e simple calculations on selected signals, does some simple logic, sends so= me commands and finally computes some 1Hz...

Vancouver Python/Zope: Extreme Graph Programming in Python
October's Vancouver Python/Zope meeting will be held on Tuesday, October 5, 2004. Mishtu Banerjee will talk and demonstrate aspects of graph programming[2] in Python. If that does cover the full hour, we will re-deliver some talks that were done at the VPW conference. Paul Prescod [1] http://c2.com/cgi/wiki?ExtremeHour [2] http://www.harmeny.com/twiki/bin/view/Main/XAYAThinkingWithData ...

limiting memory consumption of Python itself or a dict in a Python program
Hello everybody, I'm pondering the following problem: I want to write a Python program that receives messages via SMTP and stores them in a dict or an array. For my purposes it would be important that all received mail would be kept in RAM and not cached out to disk. If a new message comes in that can't fit in the allocated memory, a number of old messages would be discarded. As the server needs to have room for other tasks, I'd like to limit the overall memory consumption to a certain amount. Is this possible? How would I go about implementing it? By imposing "ulimit"...

Embedding Python
Hello, I'm embedding Python interpreter in a Win32 console application. I use C++. I would like to use the WinAPI LoadLibrary function to load the python dll at runtime (followed by GetProcAddress calls), so that I have to make no assumptions about the location of the dll. However I can't use the macro Py_DECREF if I load the dll this way. Is there a way to properly free python objects (specifically - dictionaries created by PyDict_New() and the object returned by PyRun_String()) not using Py_DECREF? Alternatively, is there a way to include the python header - to make the macro Py...

Python multithreading on cluster system? Embedding python in PVM?
Hi guys.I have read that one cannot perform true multithreading in python due to global interpreter lock mechanism.Suppose i have to implement a crawler on a say cluster system like clusterknoppix so that i can use parallel virtual machine (PVM)for programming in multiprocessor environment or say open MPI.Can i integrate python with PVM or MPI.Can i embed python into C for programming in multiprocessor environment.Is there any way of embedding python in PVM or MPI so that i can implement a true cluster based search engine? Any help would be very kind.Thanks. abhinav wrote: > Hi guys.I hav...

Web resources about - Can I embedding a (python) console on python program? - comp.lang.python

Whitney embedding theorem - Wikipedia, the free encyclopedia
), if m > 0 . This is the best linear bound on the smallest-dimensional Euclidean space that all m -dimensional manifolds embed in, as the real ...

Improved Embedding Tools: Embedded Video Player API and oEmbed support
Launch of embedded video API and oEmbed support for facebook videos and posts

Instagram adds web embedding, makes sharing content on the web easier
... its platform beyond its mobile applications. Today, the photo sharing application has made it easier to share photos and videos with web embedding. ...

School transforms a generation by embedding Indigenous culture into its curriculum
From Indigenous dolls in the childcare centre to a discussion of the treatment of Adam Goodes, embedding Indigenous culture into the curriculum ...


Apple uploads individual iPhone 6 and Apple Watch promo videos to YouTube for your embedding pleasure ...
... iPhone 6 , and YouTube . What do you think? Discuss "Apple uploads individual iPhone 6 and Apple Watch promo videos to YouTube for your embedding ...

Instagram Adds Web Embedding in Bid for Real-Time Relevance
The real-time battle rages on. Instagram on Wednesday announced the latest in a string of recent updates, now allowing users to embed videos ...

The new Android Central Photography forums are open and feature Photosphere embedding
A great place to talk about the camera on your Android phone, and share the great pictures you take with it

Apple granted patent for embedding sapphire displays in LiquidMetal iPhone chassis
The U.S. Patent and Trademark Office on Tuesday issued Apple a patent describing a process in which an iPhone's display glass including sapphire ...

MPAA "embedding is infringement" theory rejected by court
Judge Posner A federal appeals court has decisively rejected a legal theory that would have placed anyone who embeds a third-party video on ...

Resources last updated: 2/17/2016 11:20:25 PM