Index: source/python/classes/GribTools.py
===================================================================
--- source/python/classes/GribTools.py	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
+++ source/python/classes/GribTools.py	(revision aa275fc4792ca811bc736b50dc19cfaa39702922)
@@ -44,8 +44,9 @@
 # ------------------------------------------------------------------------------
 import os
-from gribapi import grib_new_from_file, grib_is_defined, grib_get, \
-                    grib_release, grib_set, grib_write, grib_index_read, \
-                    grib_index_new_from_file, grib_index_add_file,  \
-                    grib_index_write
+
+from eccodes import (codes_grib_new_from_file, codes_is_defined, codes_get,
+                     codes_release, codes_set, codes_write, codes_index_read,
+                     codes_index_new_from_file, codes_index_add_file,
+                     codes_index_write)
 
 # ------------------------------------------------------------------------------
@@ -104,7 +105,7 @@
 
         while 1:
-            gid_in = grib_new_from_file(fileid)
-
-            if gid_in is None:
+            gid = codes_new_from_file(fileid)
+
+            if gid is None:
                 break
 
@@ -116,9 +117,9 @@
             i = 0
             for wherekey in wherekeynames:
-                if not grib_is_defined(gid_in, wherekey):
+                if not codes_is_defined(gid, wherekey):
                     raise Exception("where key was not defined")
 
                 select = (select and (str(wherekeyvalues[i]) ==
-                                      str(grib_get(gid_in, wherekey))))
+                                      str(codes_get(gid, wherekey))))
                 i += 1
 
@@ -126,8 +127,8 @@
                 llist = []
                 for key in keynames:
-                    llist.extend([str(grib_get(gid_in, key))])
+                    llist.extend([str(codes_get(gid, key))])
                 return_list.append(llist)
 
-            grib_release(gid_in)
+            codes_release(gid)
 
         fileid.close()
@@ -178,7 +179,7 @@
 
         while 1:
-            gid_in = grib_new_from_file(fin)
-
-            if gid_in is None:
+            gid = codes_new_from_file(fin)
+
+            if gid is None:
                 break
 
@@ -189,9 +190,9 @@
             i = 0
             for wherekey in wherekeynames:
-                if not grib_is_defined(gid_in, wherekey):
+                if not codes_is_defined(gid, wherekey):
                     raise Exception("where Key was not defined")
 
                 select = (select and (str(wherekeyvalues[i]) ==
-                                      str(grib_get(gid_in, wherekey))))
+                                      str(codes_get(gid, wherekey))))
                 i += 1
 
@@ -199,10 +200,10 @@
                 i = 0
                 for key in keynames:
-                    grib_set(gid_in, key, keyvalues[i])
+                    codes_set(gid, key, keyvalues[i])
                     i += 1
 
-            grib_write(gid_in, fout)
-
-            grib_release(gid_in)
+            codes_write(gid, fout)
+
+            codes_release(gid)
 
         fin.close()
@@ -245,7 +246,7 @@
 
         while 1:
-            gid_in = grib_new_from_file(fin)
-
-            if gid_in is None:
+            gid = codes_new_from_file(fin)
+
+            if gid is None:
                 break
 
@@ -256,19 +257,19 @@
             i = 0
             for key in keynames:
-                if not grib_is_defined(gid_in, key):
+                if not codes_is_defined(gid, key):
                     raise Exception("Key was not defined")
 
                 if selectWhere:
                     select = (select and (str(keyvalues[i]) ==
-                                          str(grib_get(gid_in, key))))
+                                          str(codes_get(gid, key))))
                 else:
                     select = (select and (str(keyvalues[i]) !=
-                                          str(grib_get(gid_in, key))))
+                                          str(codes_get(gid, key))))
                 i += 1
 
             if select:
-                grib_write(gid_in, fout)
-
-            grib_release(gid_in)
+                codes_write(gid, fout)
+
+            codes_release(gid)
 
         fin.close()
@@ -301,5 +302,5 @@
 
         if os.path.exists(index_file):
-            iid = grib_index_read(index_file)
+            iid = codes_index_read(index_file)
             print("Use existing index file: %s " % (index_file))
         else:
@@ -307,10 +308,10 @@
                 print("Inputfile: %s " % (filename))
                 if iid is None:
-                    iid = grib_index_new_from_file(filename, index_keys)
+                    iid = codes_index_new_from_file(filename, index_keys)
                 else:
-                    grib_index_add_file(iid, filename)
+                    codes_index_add_file(iid, filename)
 
             if iid is not None:
-                grib_index_write(iid, index_file)
+                codes_index_write(iid, index_file)
 
         print('... index done')
