|
Re: newbie: loading' example' example in python: msg#00117programming.swig
On Fri, 24 Jan 2003 10:04:16 -0800 Harry Mangalam <hjm@xxxxxxxxx> wrote: > Hmm - I see this now browsing the 'example.py' file that was generated. > > ...and you have to invoke it as: > > $ python -i example.py Not necessarily, you need to put both example.py and _example.so in your PYTHONPATH. If you are just testing, you can use any directory. So what does this mean for you? You need to: cd /path/to/dir/where/example.py cp build/lib-something/_example.so . Now you should be able to just 'import example'. You may want to look at the attached setup.py and the python documentation for distutils ( http://python.org/doc/2.1/dist/dist.html ). setup.py is for a custon C wrapper I use for a few libraries. > > and only then you have access to the functions via their original names (which > > is very convenient) but where is this documented? How did you expect to access the functions ? > the docs, which I reviewed > several times imply that this is NOT the way to do it (and make no mention of > the way you suggest). True, again SWIG assumes that you will access them via example.py. This would seem to be the expected behavior -- you access them in python, just the same as you would in C. > The docs say > <quote> > $python > >>> import example > >>> example.fact(4) > 24 > >>> > </quote> > > and make no mention at all of the correct way to use it. Tho the chapter does > > note that it is under repair... Refer to the above remark, this should help. Nic -- Nicholas Henke Linux Cluster Systems Programmer Liniac Project - Univ. of Pennsylvania
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: newbie: loading' example' example in python: 00117, Harry Mangalam |
|---|---|
| Next by Date: | custom function/return type: 00117, André Jonsson |
| Previous by Thread: | Re: newbie: loading' example' example in pythoni: 00117, Harry Mangalam |
| Next by Thread: | Re: newbie: loading' example' example in python: 00117, William S Fulton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |