Index: trunk/ippToPsps/jython/dvo.py
===================================================================
--- trunk/ippToPsps/jython/dvo.py	(revision 34104)
+++ trunk/ippToPsps/jython/dvo.py	(revision 34107)
@@ -109,7 +109,6 @@
         self.logger.infoPair("DVO Photcodes.dat file", "NOT up-to-date")
 
-        self.importFits(
+        self.importPhotcodes(
                 path,
-                "CODE NAME TYPE",
                 self.scratchDb.dvoPhotcodesTable)
         self.logger.infoPair("Adding primary key to", self.scratchDb.dvoPhotcodesTable)
@@ -491,2 +490,44 @@
       return tableName
 
+    '''
+    Imports the Photcode file
+    '''
+    def importPhotcodes(self, path, tableName):
+
+      self.logger.infoPair("Importing file", "%s (%s)" % (path, self.getFileSizeStr(self.getDiskSize(path))))
+      self.logger.debugPair("Writing to database table", tableName)
+
+      tables = stilts.treads(path)
+
+      # complain if len(tables) > 1
+
+      self.logger.debugPair("Reading IPP table", tables[0].name)
+      table = stilts.tpipe(tables[0], cmd='explodeall')
+     
+      # IPP FITS files are littered with infinity values. Remove them (probably not needed for photcodes)
+      self.logger.debugPair("Removing", "infinity values")
+      table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
+      table = stilts.tpipe(table, cmd='replaceval Infinity null *')
+
+      # convert the 1-char field TYPE to an int for querying ease (probably more sophisticated was to do this...)
+      table = stilts.tpipe(table, cmd='addcol -after TYPE TYPE_AS_INT "TYPE + 0"')
+
+      attempts = 0
+      self.logger.debugPair("Writing table to database",  table.name)
+      while True:
+    
+          try:
+              if attempts > 0: self.logger.infoPair("Attempt %d to write" % attempts, table.name)
+              table.cmd_keepcols("CODE NAME TYPE_AS_INT").write(self.scratchDb.url + '#' + tableName)
+              break
+          except:
+              # wait a few secs then try again
+              time.sleep(2)
+              attempts = attempts + 1
+              
+              count = count + 1
+              
+      self.logger.debugPair("Finished importing", tableName)
+
+      return tableName
+
