networkdynamics / zenlib

The Zero Effort Network Library for Python
http://zen.networkdynamics.org
Other
67 stars 25 forks source link

Can't compile with Python 3 #26

Open plison opened 7 years ago

plison commented 7 years ago

I get an error when trying to compile the library (using Python 3.5):

cythoning zen/algorithms/shortest_path.pyx to zen/algorithms/shortest_path.c

Error compiling Cython file:
------------------------------------------------------------
...
        return distance, predecessor
    else:
        return distance

def dijkstra_cmp(x,y):
    return cmp(x.cost,y.cost)
          ^
------------------------------------------------------------

zen/algorithms/shortest_path.pyx:680:11: undeclared name not builtin: cmp

The error is most likely caused by the removal of the cmp builtin function from Python 3, see https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons

druths commented 7 years ago

I'm surprised that's the only error :) haven't made zen 3.X compatible yet. That's well overdue, though. I'll prioritize this and aim to have it done by end of next week.

On Jun 27, 2017, 8:40 AM -0400, Pierre Lison notifications@github.com, wrote:

I get an error when trying to compile the library (using Python 3.5): cythoning zen/algorithms/shortest_path.pyx to zen/algorithms/shortest_path.c

Error compiling Cython file:

... return distance, predecessor else: return distance

def dijkstra_cmp(x,y): return cmp(x.cost,y.cost) ^

zen/algorithms/shortest_path.pyx:680:11: undeclared name not builtin: cmp The error is most likely caused by the removal of the cmp builtin function from Python 3, see https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ocean1 commented 5 years ago

I worked a bit on it on a porting https://github.com/caterpy/zenlib

caveats:

also, occasionally python3 heapq seems faster than fiboheapc:)

I believe this issue could be merged with #19