Skip to content

Instantly share code, notes, and snippets.

@anxiousmodernman
Last active August 29, 2015 14:02
Show Gist options
  • Save anxiousmodernman/a04d79ea73cc56892032 to your computer and use it in GitHub Desktop.
Save anxiousmodernman/a04d79ea73cc56892032 to your computer and use it in GitHub Desktop.
IndexError in the table_instance class

Here is some pdb debugger output from the surrounding code that leads to the IndexError. I put a debug statement in the grabMetadata() method of MLS_Data, and then stepped into the constructor of the table_instance class.

>>> ================================ RESTART ================================
>>> 
What is the prefix for this MLS?XXX
couldnt find saved resource; looking elsewhere.
connecting
getting resources
here, 3
> c:\users\coleman\code\homesnap-master\sarah\mls_data_class.py(174)grabMetadata()
-> all_tables[table.GetSystemName()] = table_instance(table, metadata, self.search.resource_name)
(Pdb) step
--Call--
> c:\users\coleman\code\homesnap-master\sarah\table_instance.py(22)__init__()
-> def __init__(self, table, metadata, resource_name):
(Pdb) c
> c:\users\coleman\code\homesnap-master\sarah\table_instance.py(39)__init__()
-> self.Interpretation = table.GetInterpretation()
(Pdb) n
> c:\users\coleman\code\homesnap-master\sarah\table_instance.py(40)__init__()
-> self.IsUnique = table.IsUnique()
(Pdb) self.Interpretation
7
(Pdb) c

Traceback (most recent call last):
  File "C:\Users\coleman\Code\homesnap-master\sarah\main.py", line 230, in <module>
    data.grabMetadata(session)
  File "C:\Users\coleman\Code\homesnap-master\sarah\mls_data_class.py", line 174, in grabMetadata
    all_tables[table.GetSystemName()] = table_instance(table, metadata, self.search.resource_name)
  File "C:\Users\coleman\Code\homesnap-master\sarah\table_instance.py", line 40, in __init__
    self.IsUnique = table.IsUnique()
IndexError: list index out of range
>>> 

The table_instance class declares a list that you apparently access by index.

interpretation_list=['NUMBER','CURRENCY','LOOKUP','LOOKUP_MULTI', 'LOOKUP_BITSTRING', 'LOOKUP_BITMASK', 'NO_INTERPRETATION']
#                     0         1        2           3               4                  5                   s

The problem is that the call to GetInterpretation() returns 7 and sets the attribute self.Interpretation to 7, as you can see from my debugger output above.

    self.Interpretation = table.GetInterpretation()  # this returns 7

Is the interpretation_list something that needs editing or appending to?

The new list you sent fixed that bug, the code continues, and I get to this prompt:

Which of these fields (please input StandardName) should we use?:

Here is the full output.

>>> ================================ RESTART ================================
>>> 
What is the prefix for this MLS?XXX
couldnt find saved resource; looking elsewhere.
connecting
getting resources
here, 3
here, 4
have metadata
here, 5
> c:\users\coleman\code\homesnap-master\sarah\main.py(236)<module>()
-> if unknown_class:
(Pdb) unknown_class
False
(Pdb) n
> c:\users\coleman\code\homesnap-master\sarah\main.py(249)<module>()
-> if ((not hasattr(data, 'recordCount')) or get_data): # and len(data.search.search_terms)>0
(Pdb) get_data
1
(Pdb) c
set select is ['LIST_135', 'LIST_134', 'LIST_137', 'LIST_131', 'LIST_130', 'LIST_133', 'LIST_132', 'ROOM_GRM_room_level', 'ROOM_GRM_room_rem', 'ROOM_BNK_room_level', 'GF20140113205903877367000000', 'ROOM_CY_room_level', 'listing_member_url', 'GF20140301040614242393000000', 'ROOM_BNK_room_rem', 'ROOM_CP_room_rem', 'GF20131203222306734642000000', 'ROOM_BF_room_level', 'ROOM_DN_room_level', 'BOARDCODE', 'listing_office_shortid', 'LIST_22', 'LIST_23', 'LIST_21', 'LIST_26', 'LIST_27', 'ROOM_CVP_room_level', 'LIST_29', 'ROOM_GH_room_level', 'listing_office_address', 'GF20131203230400303531000000', 'ROOM_WS_room_level', 'selling_member_address', 'listing_office_email', 'ROOM_DK_room_rem', 'ROOM_SD_room_rem', 'ROOM_LB_room_rem', 'ROOM_OT_room_rem', 'ROOM_SP_room_level', 'ROOM_DLC_room_level', 'ROOM_LG_room_rem', 'ROOM_DLC_room_rem', 'LIST_140', 'LIST_141', 'LIST_142', 'LIST_143', 'LIST_144', 'LIST_145', 'ROOM_BA_room_rem', 'ROOM_PN_room_level', 'ROOM_BW_room_rem', 'GF20140301040553499723000000', 'colisting_member_address', 'ROOM_LRM_room_rem', 'listing_office_name', 'ROOM_OC_room_rem', 'ROOM_SN_room_rem', 'ROOM_GH_room_rem', 'ROOM_MDR_room_rem', 'GF20131203185651514669000000', 'UNBRANDEDIDXVIRTUALTOUR', 'GF20131203185526796706000000', 'ROOM_LG_room_level', 'ROOM_DN_room_rem', 'LIST_57', 'LIST_56', 'ROOM_ST_room_level', 'LIST_54', 'LIST_53', 'LIST_52', 'LIST_51', 'LIST_50', 'coselling_member_phone', 'ROOM_FR_room_level', 'LIST_59', 'VOWList', 'ROOM_DKC_room_rem', 'ROOM_SN_room_level', 'coselling_member_fax', 'selling_member_email', 'GF20131203203523234694000000', 'ROOM_OC_room_level', 'ROOM_LF_room_rem', 'colisting_member_phone', 'LIST_153', 'LIST_152', 'LIST_151', 'LIST_150', 'LIST_157', 'LIST_156', 'LIST_155', 'LIST_154', 'ROOM_MR_room_level', 'ROOM_UR_room_rem', 'LIST_159', 'LIST_158', 'ROOM_CP_room_level', 'GF20140301040517604689000000', 'colisting_member_url', 'ROOM_ER_room_rem', 'VOWComm', 'listing_office_phone', 'ROOM_OF_room_rem', 'VOWAddr', 'LIST_45', 'LIST_46', 'LIST_47', 'LIST_40', 'LIST_41', 'selling_office_shortid', 'LIST_43', 'GF20140301040603658419000000', 'GF20131203184218636299000000', 'LIST_48', 'LIST_49', 'ROOM_FLR_room_rem', 'GF20131203185627775813000000', 'LIST_3', 'LIST_2', 'LIST_1', 'LIST_0', 'LIST_7', 'LIST_6', 'LIST_5', 'LIST_4', 'ROOM_MB_room_level', 'ROOM_OT_room_level', 'LIST_9', 'LIST_8', 'listing_member_phone', 'GF20131203184139008236000000', 'ROOM_B12_room_level', 'LIST_162', 'LIST_163', 'LIST_160', 'LIST_161', 'GF20131203185720810239000000', 'ROOM_FR_room_rem', 'ROOM_ER_room_level', 'coselling_member_shortid', 'ROOM_HR_room_level', 'ROOM_DKC_room_level', 'listing_office_url', 'ROOM_SA_room_level', 'ROOM_LF_room_level', 'coselling_member_name', 'ROOM_PR_room_level', 'LIST_70', 'LIST_72', 'LIST_75', 'LIST_77', 'LIST_76', 'LIST_79', 'LIST_78', 'selling_member_name', 'ROOM_RS_room_level', 'selling_office_fax', 'ROOM_FDR_room_rem', 'colisting_member_name', 'ROOM_LRM_room_level', 'ROOM_BK_room_rem', 'ROOM_BL_room_rem', 'selling_member_url', 'ROOM_GR_room_level', 'ROOM_FY_room_rem', 'ROOM_OF_room_level', 'ROOM_BF_room_rem', 'coselling_member_email', 'ROOM_SR_room_level', 'selling_office_name', 'ROOM_PR_room_rem', 'coselling_member_address', 'GF20131203203501805928000000', 'ROOM_TR_room_level', 'listing_member_email', 'GF20131203222632429564000000', 'ROOM_DA_room_rem', 'GF20131203203446527084000000', 'ROOM_SA_room_rem', 'GF20131203230336948736000000', 'GF20131203185600743925000000', 'ROOM_EIK_room_level', 'selling_office_email', 'ROOM_BK_room_level', 'ROOM_FLR_room_level', 'ROOM_B12_room_rem', 'LIST_68', 'LIST_69', 'LIST_66', 'ROOM_WS_room_rem', 'LIST_64', 'ROOM_NR_room_rem', 'LIST_62', 'LIST_63', 'LIST_61', 'LIST_108', 'LIST_109', 'ROOM_SD_room_level', 'GF20140301040543504795000000', 'LIST_104', 'LIST_105', 'LIST_106', 'LIST_107', 'ROOM_MB_room_rem', 'LIST_102', 'LIST_103', 'LIST_93', 'LIST_92', 'LIST_91', 'LIST_90', 'LIST_97', 'LIST_96', 'LIST_95', 'LIST_94', 'colisting_member_email', 'ROOM_DR_room_level', 'ROOM_MR_room_rem', 'ROOM_SR_room_rem', 'ROOM_MDR_room_level', 'ROOM_TR_room_rem', 'ROOM_DK_room_level', 'ROOM_RR_room_rem', 'listing_member_fax', 'GF20131203222329624962000000', 'ROOM_BMS_room_rem', 'ROOM_SP_room_rem', 'ROOM_BL_room_level', 'selling_office_phone', 'ROOM_LR_room_level', 'LIST_19', 'LIST_18', 'ROOM_HR_room_rem', 'colisting_member_fax', 'LIST_13', 'LIST_12', 'LIST_11', 'LIST_10', 'LIST_17', 'LIST_16', 'LIST_15', 'GF20131203222538613490000000', 'selling_office_url', 'selling_member_shortid', 'LIST_119', 'LIST_118', 'LIST_117', 'LIST_116', 'LIST_115', 'LIST_114', 'LIST_113', 'LIST_112', 'LIST_111', 'LIST_110', 'LIST_80', 'GF20140301040458839511000000', 'LIST_82', 'LIST_84', 'LIST_85', 'LIST_86', 'LIST_87', 'LIST_88', 'LIST_89', 'ROOM_BMS_room_level', 'GF20131203222557967287000000', 'ROOM_UR_room_level', 'ROOM_CY_room_rem', 'ROOM_LB_room_level', 'GF20131204002446559965000000', 'BRANDEDVIRTUALTOUR', 'ROOM_DR_room_rem', 'ROOM_EIK_room_rem', 'ROOM_CVP_room_rem', 'colisting_member_shortid', 'ROOM_KT_room_level', 'ROOM_GR_room_rem', 'ROOM_BR_room_rem', 'ROOM_ST_room_rem', 'selling_member_phone', 'ROOM_LR_room_rem', 'listing_member_address', 'ROOM_BA_room_level', 'coselling_member_url', 'LIST_122', 'LIST_120', 'LIST_121', 'LIST_126', 'LIST_127', 'LIST_124', 'LIST_125', 'LIST_128', 'ROOM_KT_room_rem', 'ROOM_RR_room_level', 'VOWAVM', 'ROOM_FY_room_level', 'listing_office_fax', 'ROOM_FDR_room_level', 'GF20131203203513863218000000', 'ROOM_BW_room_level', 'ROOM_BR_room_level', 'LIST_35', 'LIST_34', 'LIST_37', 'LIST_31', 'LIST_33', 'ROOM_PN_room_rem', 'LIST_39', 'GF20131203185458688530000000', 'listing_member_shortid', 'ROOM_DA_room_level', 'ROOM_NR_room_level', 'ROOM_RS_room_rem', 'FEAT20140102155720464036000000', 'selling_member_fax', 'listing_member_name', 'selling_office_address']
Must pick field for statuses:
127 :  LIST_15  [ListingStatus]  [Status]
:  [ Deleted ],  [ Pending ],  [ Expired ],  [ Cancelled ],  [ Temp Off Market ],  [ Active ],  [ Sold ],  

1 :  LIST_93  []  [Construction Status]
:  [ To Be Built ],  [ Under Construction ],  [ Construction Complete ],  

1 :  LIST_91  []  [Occupancy Status]
:  [ Occupied ],  [ Vacant ],  [ New ],  [ Vacation Rental ],  




Which of these fields (please input StandardName) should we use?:

What is the meaning of this prompt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment