DrTrigon added a comment.

@AbdealiJK: Thanks a lot! Had to patch it a bit as you mentioned, see https://gist.github.com/drtrigon/a1945629d1e7d7f566045629a43c0b06

First I got this error, which I solved by adding some unicode() (see patch also):

$ python bulk.py -search:'eth-bib' -limit:5 -logname:test -dryrun:1
Retrieving 5 pages from commons:commons.
1 . Analyzing File:Alfred Werner ETH-Bib Portr 09965.jpg
ERROR:root:ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
Traceback (most recent call last):
  File "bulk.py", line 251, in run
    log += self._test_file(page, path)
  File "bulk.py", line 137, in _test_file
    col_info['Color:EdgeRatio'])
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
2 . Analyzing File:Augusto Gansser ETH-Bib Dia 022-005.jpg
ERROR:root:ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
Traceback (most recent call last):
  File "bulk.py", line 251, in run
    log += self._test_file(page, path)
  File "bulk.py", line 137, in _test_file
    col_info['Color:EdgeRatio'])
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
3 . Analyzing File:Aurel Stodola ETH-Bib Portr 06960.jpg
ERROR:root:ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
Traceback (most recent call last):
  File "bulk.py", line 251, in run
    log += self._test_file(page, path)
  File "bulk.py", line 137, in _test_file
    col_info['Color:EdgeRatio'])
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
4 . Analyzing File:Aurel Stodola ETH-Bib Portr 09556.jpg
ERROR:root:ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
Traceback (most recent call last):
  File "bulk.py", line 251, in run
    log += self._test_file(page, path)
  File "bulk.py", line 137, in _test_file
    col_info['Color:EdgeRatio'])
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
5 . Analyzing File:ERMETH ETH-Bib Ans 00290.jpg
ERROR:root:ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
Traceback (most recent call last):
  File "bulk.py", line 251, in run
    log += self._test_file(page, path)
  File "bulk.py", line 137, in _test_file
    col_info['Color:EdgeRatio'])
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')

VERBOSE:pywiki:Dropped throttle(s).
VERBOSE:pywiki:Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
VERBOSE:pywiki:All threads finished.

and then I succeeded ;)

$ python bulk.py -search:'eth-bib' -limit:5 -logname:test -dryrun:1
Retrieving 5 pages from commons:commons.
1 . Analyzing File:Alfred Werner ETH-Bib Portr 09965.jpg
WARNING: /home/osboxes/core/file_metadata/utilities.py:88: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  for data in iter(lambda: _file.read(block_size), ''):

WARNING:py.warnings:/home/osboxes/core/file_metadata/utilities.py:88: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  for data in iter(lambda: _file.read(block_size), ''):

WARNING:root:HAAR Cascade analysis requires the optional dependency OpenCV 2.x to be installed.
2 . Analyzing File:Augusto Gansser ETH-Bib Dia 022-005.jpg
WARNING:root:HAAR Cascade analysis requires the optional dependency OpenCV 2.x to be installed.
3 . Analyzing File:Aurel Stodola ETH-Bib Portr 06960.jpg
WARNING:root:HAAR Cascade analysis requires the optional dependency OpenCV 2.x to be installed.
4 . Analyzing File:Aurel Stodola ETH-Bib Portr 09556.jpg
WARNING:root:HAAR Cascade analysis requires the optional dependency OpenCV 2.x to be installed.
5 . Analyzing File:ERMETH ETH-Bib Ans 00290.jpg
WARNING:root:HAAR Cascade analysis requires the optional dependency OpenCV 2.x to be installed.


==== [[:File:Alfred Werner ETH-Bib Portr 09965.jpg]] ====
{| class="wikitable"
|
* '''Mime Type''': image/jpeg
* '''Average RGB value''': 69.131, 68.688, 65.987
* '''Closest Pantone color''': PMS 19-0405 TPX (Beluga)
* '''Edge Ratio''': 0.32789208962
* '''Number of grey shades used''': 47
* '''Percent of the palette occuring frequently''': 0.141176470588
* Face #1
** Using: dlib/flandmark
** Score: 1.02
** Bounding Box: Left:187, Top:401, Width:643, Height:643
* '''Time taken''': 36.735373 sec
|
<div style="position:relative;">
[[File:Alfred Werner ETH-Bib Portr 09965.jpg|136x200px]]
<div class="position-marker file-meta-face" style="position:absolute; left:18px; top:39px; width:62px; height:62px; border:2px solid #00ff00;"></div>
</div>
|}


==== [[:File:Augusto Gansser ETH-Bib Dia 022-005.jpg]] ====
{| class="wikitable"
|
* '''Mime Type''': image/jpeg
* '''Average RGB value''': 153.041, 149.583, 142.662
* '''Closest Pantone color''': PMS 16-4400 TPX (Mourning Dove)
* '''Edge Ratio''': 0.233318514327
* '''Number of grey shades used''': 210
* '''Percent of the palette occuring frequently''': 0.247058823529
* Face #1
** Using: dlib/flandmark
** Score: 0.57
** Bounding Box: Left:246, Top:112, Width:87, Height:87
* '''Time taken''': 2.109742 sec
|
<div style="position:relative;">
[[File:Augusto Gansser ETH-Bib Dia 022-005.jpg|200x166px]]
<div class="position-marker file-meta-face" style="position:absolute; left:82px; top:37px; width:29px; height:29px; border:2px solid #00ff00;"></div>
</div>
|}


==== [[:File:Aurel Stodola ETH-Bib Portr 06960.jpg]] ====
{| class="wikitable"
|
* '''Mime Type''': image/jpeg
* '''Average RGB value''': 175.903, 169.415, 143.133
* '''Closest Pantone color''': PMS 15-0513 TPX (Eucalyptus)
* '''Edge Ratio''': 0.276959453902
* '''Number of grey shades used''': 127
* '''Percent of the palette occuring frequently''': 0.354248366013
* Face #1
** Using: dlib/flandmark
** Score: 1.62
** Bounding Box: Left:134, Top:134, Width:216, Height:216
* '''Time taken''': 2.300966 sec
|
<div style="position:relative;">
[[File:Aurel Stodola ETH-Bib Portr 06960.jpg|145x200px]]
<div class="position-marker file-meta-face" style="position:absolute; left:44px; top:44px; width:72px; height:72px; border:2px solid #00ff00;"></div>
</div>
|}


==== [[:File:Aurel Stodola ETH-Bib Portr 09556.jpg]] ====
{| class="wikitable"
|
* '''Mime Type''': image/jpeg
* '''Average RGB value''': 106.645, 101.958, 94.981
* '''Closest Pantone color''': PMS 19-0808 TPX (Morel)
* '''Edge Ratio''': 0.271034443131
* '''Number of grey shades used''': 80
* '''Percent of the palette occuring frequently''': 0.0941176470588
* Face #1
** Using: dlib/flandmark
** Score: 0.31
** Bounding Box: Left:104, Top:161, Width:259, Height:259
* '''Time taken''': 2.072901 sec
|
<div style="position:relative;">
[[File:Aurel Stodola ETH-Bib Portr 09556.jpg|146x200px]]
<div class="position-marker file-meta-face" style="position:absolute; left:34px; top:53px; width:86px; height:86px; border:2px solid #00ff00;"></div>
</div>
|}


==== [[:File:ERMETH ETH-Bib Ans 00290.jpg]] ====
{| class="wikitable"
|
* '''Mime Type''': image/jpeg
* '''Average RGB value''': 122.335, 121.702, 118.865
* '''Closest Pantone color''': PMS 18-5102 TPX (Brushed Nickel)
* '''Edge Ratio''': 0.224917441468
* '''Number of grey shades used''': 255
* '''Percent of the palette occuring frequently''': 0.990849673203
* '''Time taken''': 1.438128 sec
|
<div style="position:relative;">
[[File:ERMETH ETH-Bib Ans 00290.jpg|144x200px]]
</div>
|}
VERBOSE:pywiki:Dropped throttle(s).
VERBOSE:pywiki:Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
VERBOSE:pywiki:All threads finished.

as you can see there are basically 2 (or 3?) different warnings:

WARNING: /home/osboxes/core/file_metadata/utilities.py:88: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  for data in iter(lambda: _file.read(block_size), ''):

WARNING:py.warnings:/home/osboxes/core/file_metadata/utilities.py:88: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  for data in iter(lambda: _file.read(block_size), ''):

WARNING:root:HAAR Cascade analysis requires the optional dependency OpenCV 2.x to be installed.

How to install this "optional dependency OpenCV 2.x"?


TASK DETAIL
https://phabricator.wikimedia.org/T136985

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: DrTrigon
Cc: zhuyifei1999, jayvdb, AbdealiJK, Aklapper, pywikibot-bugs-list, DrTrigon, Zppix, Lethexie, Jay8g
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to