mzucker / noteshrink

Convert scans of handwritten notes to beautiful, compact PDFs
https://mzucker.github.io/2016/09/20/noteshrink.html
MIT License
4.81k stars 351 forks source link

TypeError: unique() got an unexpected keyword argument 'return_counts' #19

Open larsga opened 7 years ago

larsga commented 7 years ago

Tried running noteshrink on a JPEG saved from MacOS Preview, with the following result:

Larss-MacBook-Pro:shrink larsga$ noteshrink IMG_544*
opened IMG_5442.JPG
  getting palette...
Traceback (most recent call last):
  File "/usr/local/bin/noteshrink", line 9, in <module>
    load_entry_point('noteshrink==0.1.1', 'console_scripts', 'noteshrink')()
  File "/Library/Python/2.7/site-packages/noteshrink.py", line 584, in main
    notescan_main(options=get_argument_parser().parse_args())
  File "/Library/Python/2.7/site-packages/noteshrink.py", line 560, in notescan_main
    palette = get_palette(samples, options)
  File "/Library/Python/2.7/site-packages/noteshrink.py", line 383, in get_palette
    bg_color = get_bg_color(samples, 6)
  File "/Library/Python/2.7/site-packages/noteshrink.py", line 108, in get_bg_color
    unique, counts = np.unique(packed, return_counts=True)
TypeError: unique() got an unexpected keyword argument 'return_counts'
ptrhlm commented 7 years ago

return_counts has been added to unique()in numpy version 1.9.0. The problem may be caused by outdated numpy in your system. I recommend checking the version and trying to update it.

loefberg commented 6 years ago

I got this error. Updated numpy and that solved it.

andreadellacorte commented 6 years ago

The command I used pip install numpy --upgrade