[Gdal-dev] Read image file to Numpy, then output to image

Christopher Barker Chris.Barker at noaa.gov
Wed May 9 13:35:48 EDT 2007


Nate Jennings wrote:
> I did that too.  img = gdal.Open... with the same error.  I saw various 
> forms of the open on different websites.
> 
> I also tried gdal.RegisterAll() with the same error.  It seems like I am 
> not able to access any of the functions within gdal.  I just sent 
> another post to Gdal-dev with a refined comment.  If this is the case, I 
> am unsure what I need to do to either uninstall, re-install or where to 
> look to fix the problem.  I have the _gdal.pyd in the DLL directory and 
> I have a __init__.py in my site-packages\gdal directory.  I am able to 
> do the import gdal, but writing any code to use any of the functions 
> within gdal seem to be unaccessible.

It looks like something is odd in your install. I haven't got it set up 
on Windows, so I don't know what may have happened, but:

1) It sounds like "import gdal" works. That's a good start.

2) Your error: "AttributeError: 'module' object has no attribute 'gdal'" 
means that python isn't finding that function, so it has nothing to do 
with registering drivers or anything. I'd guess you have an incomplete 
install somehow.

3) try:

 >>> import gdal
 >>> print dir(gdal).

You should get a LOT of stuff, including Open(). If you want to make it 
a bit easier to see what you've got:

 >>> for i in dir(gdal):
...    print i

Let us know what you get, and maybe we can help.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the Gdal-dev mailing list