Skip to content Skip to sidebar Skip to footer

Can't Get Python Idle To Recognize Ogr/gdal Module

Folks, Just getting started using OGR and Python for a variety of geospatial tasks. I'm working outside of OSGEO4w, and have installed GDAL w/ Python Bindings as well as Python v.

Solution 1:

Mike,

You can open IDLE with your python installation from the cmd line through:

>>>from idlelib importPyShell  
>>>PyShell.main()

This should open IDLE from your current python, and you should be able then to import gdal and ogr from there.

Alternatively, you should have a windows batch file here C:\YOURPYTHONPATH\Lib\idlelib\idle.bat

Running this should achieve the same.

Martin

Solution 2:

Consider creating the following batch where PyInst references the Python installation folder from which IDLE is launched (i.e. idle.bat) and QgisInst references the folder containing "bin\o4w_env.bat":

@echo offset PyInst=C:\Python27
set QgisInst="C:\Program Files\QGIS Brighton"call %QgisInst%\bin\o4w_env.bat
set PYTHONPATH=%PyInst%\DLLs;%PyInst%\Lib;%PyInst%\Lib\lib-tk
set TCL_LIBRARY=%PyInst%\tcl\tcl8.5
python %PyInst%\Lib\idlelib\idle.pyw

Post a Comment for "Can't Get Python Idle To Recognize Ogr/gdal Module"