[osgeo4w-dev] [osgeo4w] #301: Problem running gdal*.py in osgeo4w shell

OSGeo4W trac_osgeo4w at osgeo.org
Tue Sep 11 10:48:35 PDT 2012


#301: Problem running gdal*.py in osgeo4w shell
------------------------+---------------------------------------------------
Reporter:  vascobnunes  |       Owner:  osgeo4w-dev@…              
    Type:  defect       |      Status:  new                        
Priority:  major        |   Component:  Package                    
 Version:               |    Keywords:  osgeo4w, gdal              
------------------------+---------------------------------------------------

Old description:

> I'm trying to run gdal_calc.py (and other gdal*.py) from the Osgeo4w
> shell and can't do it cause I get this error:
>
> C:\>gdal_calc
> Traceback (most recent call last):
>   File "C:\OSGeo4W\\bin\gdal_calc.py", line 47, in <module>
>     import gdal
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\gdal.py", line 2, in
> <module>
>
>     from osgeo.gdal import deprecation_warn
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\__init__.py",
> line 21,
> in <module>
>     _gdal = swig_import_helper()
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\__init__.py",
> line 17,
> in swig_import_helper
>     _mod = imp.load_module('_gdal', fp, pathname, description)
> ImportError: DLL load failed: The specified procedure could not be found.

New description:

 I'm trying to run gdal_calc.py (and other gdal*.py) from the Osgeo4w shell
 and can't do it cause I get this error:
 {{{
 C:\>gdal_calc
 Traceback (most recent call last):
   File "C:\OSGeo4W\\bin\gdal_calc.py", line 47, in <module>
     import gdal
   File "C:\OSGeo4W\apps\Python27\lib\site-packages\gdal.py", line 2, in
 <module>

     from osgeo.gdal import deprecation_warn
   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\__init__.py",
 line 21,
 in <module>
     _gdal = swig_import_helper()
   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\__init__.py",
 line 17,
 in swig_import_helper
     _mod = imp.load_module('_gdal', fp, pathname, description)
 ImportError: DLL load failed: The specified procedure could not be found.
 }}}

--

Comment(by maphew):

 It works for me at present. Perhaps your PATH environment isn't completely
 set, or there is something in it that shouldn't be (?)

 From a fresh install of nothing but `gdal-python` and prerequisites,
 '''Start > Run > cmd''' then:
 {{{
 c:\>path=%windir%;%windir%\system32

 c:\>c:\osgeo4w\OSGeo4W.bat

 OSGEO4W home is c:\osgeo4w\

                    -={ OSGeo4W Shell Commands }=-

 ---8<---snip---

 GDAL 1.9.1, released 2012/05/16

 c:\>gdal_calc

 gdal_calc.py [-A <filename>] [--A_band] [-B...-Z filename]  [--calc
 <calculation>]
  [--format] [--outfile output_file] [--type data_type] [--NoDataValue]
 [--overwrite]

 c:\>
 }}}

 host system is Win7 Pro x64.

-- 
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/301#comment:1>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the osgeo4w-dev mailing list