esolliday / libkml

Automatically exported from code.google.com/p/libkml
Other
0 stars 0 forks source link

Python KML bindings not working for trunk #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Build libkml from trunk (r413) with python bindings

cd ~/src
svn checkout http://libkml.googlecode.com/svn/trunk/ libkml-trunk
cd libkml-trunk/
sh autogen.sh
./configure --prefix=/usr/local/libkml/trunk > configure.out
make > make.out
sudo make install > make_install.out

2. Create a python path file
(/usr/lib/python2.5/site-packages/libkml-trunk.pth) that makes the libkml
files on the python path.

Path file contents...
/usr/local/libkml/trunk/lib/python2.5/site-packages

3. Open up a python shell and try to import the libkml modules

What is the expected output? What do you see instead?

I would expect to be able to import the python modules (kmldom, kmlengine,
kmlbase).  Instead I get the following errors:

Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import kmldom
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/kmldom.py", line 162, in <module>
    Type_maxSnippetLines = _kmldom.Type_maxSnippetLines
AttributeError: 'module' object has no attribute 'Type_maxSnippetLines'

>>> import kmlengine
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/kmlengine.py", line 72, in <module>
    class KmlFile(_object):
  File "/usr/lib/python2.5/site-packages/kmlengine.py", line 82, in KmlFile
    if _newclass:CreateFromImport =
staticmethod(_kmlengine.KmlFile_CreateFromImport)
AttributeError: 'module' object has no attribute 'KmlFile_CreateFromImport'

>>> import kmlbase
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/kmlbase.py", line 7, in <module>
    import _kmlbase
ImportError: No module named _kmlbase

What version of the product are you using? On what operating system?
libkml r413
Ubuntu 8.10

Did you run the unit test suite that comes with the project? Did all tests
pass?
Yes, all tests passed.

Please provide any additional information below.

Original issue reported on code.google.com by tylerick...@gmail.com on 12 Jan 2009 at 5:55

GoogleCodeExporter commented 8 years ago
I think you have some path issues here. It looks like the .so the python tries 
to
load is from and older version of libkml.

The --prefix you're using means that the swig files should be installed to
//usr/local/libkml/trunk/lib/python2.5/site-packages. You refer to both
/usr/lib/python2.5/site-packages and
/usr/local/libkml/trunk/lib/python2.5/site-packages, which seems confusing.

I just performed a fresh install on Ubuntu 8.04 and everything works fine there.

Original comment by kml.mash...@gmail.com on 12 Jan 2009 at 7:48

GoogleCodeExporter commented 8 years ago
Yes, it was a path issue. I moved the libkml 0.4.0 libraries to another 
location, and
then the issue went away.

The python path file (/usr/lib/python2.5/site-packages/libkml-trunk.pth) is 
used so
that the libkml files (/usr/local/libkml/trunk/lib/python2.5/site-packages/) 
become
part of the python path.

Original comment by tylerick...@gmail.com on 12 Jan 2009 at 9:31

GoogleCodeExporter commented 8 years ago
Glad to hear it!

Original comment by kml.mash...@gmail.com on 12 Jan 2009 at 9:44