What I’m trying to do:
Some long running code is throwing the following error
ExternalError: TypeError: $lattr66798.tp$getattr is not a function
from this line m = GoogleMap.Marker(position=results[0].geometry.location)
What I’ve tried and what’s not working:
I have checked stable versions of the app which have not had changes to this form in a long time and the error persists.
Clone link:
App contains my Maps API key so not posted but happy to share with Support on request.
What I’m trying to do:
I have a customer, who is running Chrome browser on Windows 11, and is getting a TypeError: $lattr3943.tp$getattr is not a function when trying to find the LatLng from an address.
I have not been able to reproduce this on my own machine, but he is getting the error every time he tries to call the GoogleMap.geocode().
Code handling the the call to GoogleMap.geocode():
def get_latlng(self, address: str):
try:
# Try to return cached LatLng to avoid doing more geocoding than needed
return [self._cached[address]]
except KeyError as ke:
try:
results = GoogleMap.geocode(address=address)
if len(results) > 1:
for r in results:
self._cached[r.formatted_address] = r.geometry.location
return results
else:
self._cached[results[0].formatted_address] = results[0].geometry.location
return [self._cached[results[0].formatted_address]]
except ExternalError as ee:
print(ee) # <== This is where the "TypeError: $lattr3943.tp$getattr is not a function" is thrown
return None
except Exception as e:
print(f'Exception while trying to geocode: {e}')
Code called by click event on Form:
def btn_address_get_latlng_click(self, **event_args):
locations = geocoder.get_latlng(self.tb_address.text)
try:
if len(locations) == 1:
self.tb_address_lat.text = locations[0].lat()
self.tb_address_lng.text = locations[0].lng()
elif len(locations) > 1:
# Multiple addresses returned, let user choose correct one
items = []
for l in locations:
items.append({
"formatted_address": l.formatted_address,
"location": l
})
rp = RepeatingPanel(item_template=Geocode_Result_Template, items=items)
choice = alert(
rp,
large=True,
)
else:
alert("Address not found", title="Error")
except TypeError as te:
alert("Address not found", title="Error")
Clone link:
Unable to share a full clone of my app, as it contains customer data, but can provide a clone to staff, if needed.
I have tried to find the error in the GoogleMap API docs, but without luck.