Open kaushikmit opened 8 years ago
Sounds like a Python 2/3 issue.
I may be having a similar issue.
First, PIL seems to have been replaced by Pillow, so I changed that import on line 24 to indicate Pillow instead.
Since that was in python 3 on my system, I changed the first line to
#!/usr/bin/env python3
Now I get the error:
File "Downloads/crop_morphology.py", line 168
print '%d %s -> %s / %s (%s), %s -> %s / %s (%s), %s -> %s' % (
^
SyntaxError: invalid syntax
My python skills are minimal, so I don't immediately see what's wrong with that print statement. Or maybe it's something else?
Try using 2to3 to convert the script from Python 2 to 3 (worked for me when getting the same error). To make the changes persistent:
2to3 crop_morphology.py -w
It is a python 2 -> 3 issue. The solution is considering how to access the values inside the tuple object borders:
# https://www.python.org/dev/peps/pep-3113/
borders.sort(key=lambda x: (x[3] - x[1]) * (x[4] - x[2]))
I get an error while compiling crop_morphology.py . It also shows undefined error with the print statements.
It also shows an error in the following line:
borders.sort(key=lambda (i, x1, y1, x2, y2): (x2 - x1) * (y2 - y1))
Can anyone help me in running this file successfully ?