@@ -174,7 +174,7 @@ cdef class PXDoc:
174174 """
175175
176176 if PX_open_file(self .doc, self .filename)< 0 :
177- raise " Couldn't open `%s `" % self .filename
177+ raise Exception ( " Couldn't open `%s `" % self .filename)
178178 self .isopen = 1
179179
180180 def close (self ):
@@ -224,7 +224,7 @@ cdef class BlobFile:
224224 """
225225
226226 if PX_open_blob_file(self .blob, self .filename)< 0 :
227- raise " Couldn't open blob `%s `" % self .filename
227+ raise Exception ( " Couldn't open blob `%s `" % self .filename)
228228 self .isopen = 1
229229
230230 def close (self ):
@@ -255,7 +255,7 @@ cdef class PrimaryIndex(PXDoc):
255255
256256 PXDoc.open(self )
257257 if PX_read_primary_index(self .doc)< 0 :
258- raise " Couldn't read primary index `%s `" % self .filename
258+ raise Exception ( " Couldn't read primary index `%s `" % self .filename)
259259
260260
261261cdef class Record
@@ -289,7 +289,7 @@ cdef class Table(PXDoc):
289289 f[i].px_fdc = 0
290290
291291 if PX_create_file(self .doc, f, n, self .filename, pxfFileTypIndexDB) < 0 :
292- raise " Couldn't open ` %s ` " % self .filename
292+ raise Exception ( " Couldn't open ' %s ' " % self .filename)
293293 self .isopen = 1
294294 self .current_recno = - 1
295295
@@ -330,7 +330,7 @@ cdef class Table(PXDoc):
330330 self .primary_index = PrimaryIndex(indexname)
331331 self .primary_index.open()
332332 if PX_add_primary_index(self .doc, self .primary_index.doc)< 0 :
333- raise " Couldn't add primary index `%s `" % indexname
333+ raise Exception ( " Couldn't add primary index `%s `" % indexname)
334334
335335 def setBlobFile (self , blobfilename ):
336336 """
@@ -494,13 +494,13 @@ cdef class RecordField(ParadoxField):
494494 else :
495495 py_string = PyString_FromStringAndSize(< char * > self .data, size);
496496 if not py_string:
497- raise " Cannot get value from string %s " % self .fname
497+ raise Exception ( " Cannot get value from string %s " % self .fname)
498498 return PyString_AsDecodedObject(py_string, codepage, " replace" )
499499
500500 elif self .ftype == pxfDate:
501501 if PX_get_data_long(self .record.table.doc,
502502 self .data, self .flen, & value_long)< 0 :
503- raise " Cannot extract long field '%s '" % self .fname
503+ raise Exception ( " Cannot extract long field '%s '" % self .fname)
504504 if value_long:
505505 PX_SdnToGregorian(value_long+ 1721425 ,
506506 & year, & month, & day)
@@ -511,28 +511,28 @@ cdef class RecordField(ParadoxField):
511511 elif self .ftype == pxfShort:
512512 if PX_get_data_short(self .record.table.doc,
513513 self .data, self .flen, & value_short)< 0 :
514- raise " Cannot extract short field '%s '" % self .fname
514+ raise Exception ( " Cannot extract short field '%s '" % self .fname)
515515
516516 return value_short
517517
518518 elif self .ftype == pxfLong or self .ftype == pxfAutoInc:
519519 if PX_get_data_long(self .record.table.doc,
520520 self .data, self .flen, & value_long)< 0 :
521- raise " Cannot extract long field '%s '" % self .fname
521+ raise Exception ( " Cannot extract long field '%s '" % self .fname)
522522
523523 return value_long
524524
525525 elif self .ftype == pxfCurrency or self .ftype == pxfNumber:
526526 if PX_get_data_double(self .record.table.doc,
527527 self .data, self .flen, & value_double)< 0 :
528- raise " Cannot extract double field '%s '" % self .fname
528+ raise Exception ( " Cannot extract double field '%s '" % self .fname)
529529
530530 return value_double
531531
532532 elif self .ftype == pxfLogical:
533533 if PX_get_data_byte(self .record.table.doc,
534534 self .data, self .flen, & value_char)< 0 :
535- raise " Cannot extract double field '%s '" % self .fname
535+ raise Exception ( " Cannot extract double field '%s '" % self .fname)
536536 if value_char:
537537 return True
538538 else :
@@ -550,7 +550,7 @@ cdef class RecordField(ParadoxField):
550550 codepage = self .record.table.getCodePage()
551551 py_string = PyString_FromStringAndSize(< char * > blobdata, size);
552552 if not py_string:
553- raise " Cannot get value from string %s " % self .fname
553+ raise Exception ( " Cannot get value from string %s " % self .fname)
554554 return PyString_AsDecodedObject(py_string, codepage, " replace" )
555555
556556 elif self .ftype in [pxfBLOb, pxfGraphic]:
@@ -568,7 +568,7 @@ cdef class RecordField(ParadoxField):
568568 elif self .ftype == pxfTime:
569569 if PX_get_data_long(self .record.table.doc,
570570 self .data, self .flen, & value_long)< 0 :
571- raise " Cannot extract long field '%s '" % self .fname
571+ raise Exception ( " Cannot extract long field '%s '" % self .fname)
572572 if value_long:
573573 return datetime.time(value_long/ 3600000 ,
574574 value_long/ 60000 % 60 ,
@@ -627,7 +627,7 @@ cdef class Record:
627627 """
628628
629629 if PX_get_record(self .table.doc, recno, self .data) == NULL :
630- raise " Couldn't get record %d from '%s '" % (recno,
631- self .table.filename)
630+ raise Exception ( " Couldn't get record %d from '%s '" % (recno,
631+ self .table.filename) )
632632 return True
633633
0 commit comments