[FWTools] Using Python ogr module in FWTools Shell

Frank Warmerdam warmerdam at pobox.com
Sun Oct 22 18:47:36 EDT 2006


David Fawcett wrote:
> I am trying to use the Python ogr module in the FWTools shell. 
> 
> I can type 'python' and then 'import ogr' and I don't get any errors
> 
> but if I try to run a script called hw.py at the FWTools command prompt, 
> I get the below error. 
> 
> The contents of hw.py are: 
> 
> import os
> import ogr
> 
> print "hello world"
> 
> The error is:
> 
> C:\>hw.py
> Traceback (most recent call last):
>   File "C:\hw.py", line 2, in ?
>     import ogr
>   File "C:\PROGRA~1\FWTOOL~1.5\pymod\ogr.py", line 244, in ?
>     import _gdal
> ImportError: Module use of python23.dll conflicts with this version of 
> Python.
> 
> Do I have to create/modify any environment variables? 
> 
> I do also have ActiveState Python 2.4 on this machine.  My goal is to be 
> able to run Python scripts containing the FW modules from the FWTools 
> shell without screwing up an ArcDesktop install. 

David,

The python installed with FWTools does *not* register itself with windows
as the handler for .py files, since I don't want to mess up any existing
Python installation on the system.  So if you want to run py files using
the FWTools python you should list python explicitly on the commandline
which will find the FWTools version if done in the FWTools shell (since
the path is set).

eg.

python hw.py

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the FWTools mailing list