Several questions about embedding Python

Miki Tebeka miki.tebeka at zoran.com
Wed May 5 10:38:34 EDT 2004


Hello Cameron,

> I don't know how to debug, in this sort of embedding context
> in particular; the reason you cite is a good example of why. 
Currently what I do is:
from pdb import run
...

def main():
	...

if __name__ == "__main__":
	run("main())"

If you have a .pdbrc in the current directory of the module you can set
breakpoints to it and it'll be loaded at import time.
When you hit a breakpoint the program will stop and you'll be in pdb
prompt.

> I sit and think a lot, so that I understand what my applica-
> tions do.  I don't use debuggers.  I'm still undecided about
> whether it's helpful for me to confess that.
I agree. However there are times when a debugger is priceless, I found
it help mainly with "stupid" bug (such as forgetting to declare
"global", misspelling ...).

> Yes, you can use pure SWIG wrappers.  I'll be more precise:  it
> *sounds* as though you're saying SWIG is only for extending Py-
> thon, and not embedding Python.  This is false; SWIG can be used
> to embed Python.  Maybe there's a problem with use of SWIG in a
> particular approach to embedding; just from what you've written,
> though, I think it's reasonable to expect success with SWIG's
> use.
How?
As I understand it SWIG will produce a DLL (sadly it's win2k).
I need that this DLL will share some data with the main application,
don't have a clue on how to do this.


Bye.
--
-------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://www.cs.bgu.ac.il/~tebeka
The only difference between children and adults is the price of the toys.




More information about the Python-list mailing list