File "F:\code\pyprojects\kproj\controllers.py", line 164, in index
theDistance = geography.xdistance(myLoc,theirLoc)
File "F:\code\pyprojects\kproj\geography.py", line 46, in xdistance
return geopy.distance.distance(x,y).kilometers
File
"F:\code\Python24\lib\site-packages\geopy-0.93-py2.4.egg\geopy\distance.py",
line 344, in kilometers
AttributeError: 'VincentyDistance' object has no attribute
'_kilometers'
If I change .kilometers to .miles, I get a similar error:
File "F:\code\pyprojects\kproj\controllers.py", line 164, in index
theDistance = geography.xdistance(myLoc,theirLoc)
File "F:\code\pyprojects\kproj\geography.py", line 46, in xdistance
return geopy.distance.distance(x,y).miles
File
"F:\code\Python24\lib\site-packages\geopy-0.93-py2.4.egg\geopy\distance.py",
line 92, in miles
File
"F:\code\Python24\lib\site-packages\geopy-0.93-py2.4.egg\geopy\distance.py",
line 344, in kilometers
AttributeError: 'VincentyDistance' object has no attribute
'_kilometers'
Same sort of thing if I change it to .km or .mi.
Any suggestions?
--
Ben Sizer
I think I've seen this before, but I can't remember the code that
produced it (it was fixable). Can you post the piece of your
geography.py that used geopy.distance.distance? What values are x and
y, specifically?
Thanks.
No need for that, as I think I found the issue. If x and y are exactly
equal or are the same object, this happens. My guess is that there's
some division by zero or a similar exception thrown before it reaches
the self._kilometers = s line, but caught elsewhere so that the end
application never sees it.
I can put in a special check in my code for now, but it would be great
if this could be fixed, if I've correctly identified the problem that
is!
--
Ben Sizer
Interesting, I thought the algorithm handled this properly, thanks for
the heads up.
--
Brian Beck
Adventurer of the First Order
No need for that, as I think I found the issue. If x and y are exactly
equal or are the same object, this happens. My guess is that there's
some division by zero or a similar exception thrown before it reaches
the self._kilometers = s line, but caught elsewhere so that the end
application never sees it.