简体   繁体   中英

working around an error in a python module

So I have found an error in a module I am using (which one is unimportant, but if you must know it's geopy.distance )

So I know what I have to do to fix the code, but when I open the .py file and edit it, it acts as if it was not edited!

Here is the error traceback before edited:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/geopy-0.95.1-py2.7.egg/geopy/distance.py", line 37, in __init__
    kilometers += self.measure(a, b)
  File "/Library/Python/2.7/site-packages/geopy-0.95.1-py2.7.egg/geopy/distance.py", line 72, in measure
    raise NotImplementedError
NotImplementedError

Here is the error traceback after I edit the file:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/geopy-0.95.1-py2.7.egg/geopy/distance.py", line 37, in __init__
    kilometers += self.measure(a, b)
  File "/Library/Python/2.7/site-packages/geopy-0.95.1-py2.7.egg/geopy/distance.py", line 72, in measure
    a, b = Point(a), Point(b)
NotImplementedError

as you can see, I changed it so it would not raise NotImplementedError , but it is still raising it! How is this possible?

Looks like you've edited a .py file, but the user process doesn't have permission to overwrite the .pyc file. The NotImplementedError is still on line 72 according to the .pyc file, but it's displaying the current line 72 from the .py file

Aside: Looks like Distance is an abstract class. You're not supposed to instantiate directly, but one of the subclasses of it. Eg GreatCircleDistance or VincentyDistance

Also notice the last two lines in the file

# Set the default distance formula to the most generally accurate.
distance = VincentyDistance

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM