[gdal-dev] Python documentation help

Lucena, Ivan ivan.lucena at pmldnet.com
Wed Dec 5 17:51:01 EST 2007


Howard,

It's all perfect now. I am glad to help.

 >>> import gdal
C:\Program Files\Python24\lib\site-packages\osgeo\gdal.py:90: 
DeprecationWarning: gdal.py was placed in a namespace, it is now 
available as osgeo.gdal
   DeprecationWarning)
 >>> gdal.AllRegister()
 >>> _

It warns and works!

 >>> from osgeo import gdal
 >>> gdal.AllRegister()
 >>> _

Works clean.

Best regards,

Ivan

Howard Butler wrote:
> 
> On Dec 5, 2007, at 3:03 PM, Lucena, Ivan wrote:
> 
>> Howard,
>>
>> I thing I've got it!
>>
>> Howard Butler wrote:
>>> hmm... Where could it be picking up the old-gen gdal.py from?  The 
>>> setup.py script in ./swig/python doesn't make reference to anything 
>>> in ./pymod, the ./swig/python/gdal.py *is* the simple wrapper as 
>>> expected, and setup.cfg doesn't point to ./pymod either.
>>
>> My ./swig/python/gdal.py was wrong because it was generated by SWIG.
>>
>> So I got the right gdal.py (with just a few lines) and I run setup.py 
>> bdist_wininst again and everything is fine now. See:
>>
>> >>> import gdal
>> C:\Program Files\Python24\lib\site-packages\osgeo\gdal.py:81: 
>> DeprecationWarning: gdal.py was placed in a namespace, it is now 
>> available as osgeo.gdal
>>  DeprecationWarning)
>> >>> gdal.AllRegister()
>> >>>
>>
>> If I start over and compile SWIG Python then I've got the same problem.
>>
>> I run:
>>
>> cd swig
>> nmake -f makefile.vc python
>>
>> And that re-creates the gdal.py. The bigger/wrong one.
>>
>> Well, I hope that whole discussion would help you in some way... :)
> 
> 
> Ivan,
> 
> Thanks, that was very helpful.  The windows makefile hadn't been updated 
> to put its output in the osgeo directory and it was stomping over the 
> simple wrappers.
> 
> http://trac.osgeo.org/gdal/changeset/13266
> 
> Howard
> 
> 


More information about the gdal-dev mailing list