pyzillow icon indicating copy to clipboard operation
pyzillow copied to clipboard

Some Addresses Randomly Throw TypeError

Open fouisgras opened this issue 8 years ago • 0 comments

Python 2.7, latest pyzillow release.

import numpy as np
import pandas as pd
from pyzillow.pyzillow import ZillowWrapper, GetUpdatedPropertyDetails
from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults
 
address = '255 Ewell Ct '
zipcode = '60103'
 
zillow_data = ZillowWrapper('X1-ZWz1a2vwc1ckqz_2rqd6')
deep_search_response = zillow_data.get_deep_search_results(address, zipcode)
result = GetDeepSearchResults(deep_search_response)
result

This address in particular, as well as others, will throw the following error:

TypeError                                 Traceback (most recent call last)
/home/hello/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_code(self, code_obj, result)
   2896             if result is not None:
   2897                 result.error_in_exec = sys.exc_info()[1]
-> 2898             self.showtraceback()
   2899         else:
   2900             outflag = 0

/home/hello/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in showtraceback(self, exc_tuple, filename, tb_offset, exception_only)
   1824                                             value, tb, tb_offset=tb_offset)
   1825 
-> 1826                     self._showtraceback(etype, value, stb)
   1827                     if self.call_pdb:
   1828                         # drop into debugger

/home/hello/.local/lib/python2.7/site-packages/ipykernel/zmqshell.pyc in _showtraceback(self, etype, evalue, stb)
    509             u'traceback' : stb,
    510             u'ename' : unicode_type(etype.__name__),
--> 511             u'evalue' : py3compat.safe_unicode(evalue),
    512         }
    513 

/home/hello/.local/lib/python2.7/site-packages/ipython_genutils/py3compat.pyc in safe_unicode(e)
     63     """
     64     try:
---> 65         return unicode_type(e)
     66     except UnicodeError:
     67         pass

TypeError: coercing to Unicode: need string or buffer, dict found

I have no clue why some addresses in particular are causing this error, but most of them work fine. I am iterating through a list of many addresses using pyzillow, and if get_deep_search_results doesn't like an address, my code breaks.

fouisgras avatar Feb 24 '17 00:02 fouisgras