Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make data.all results in NameError: name 'logger' is not defined #328

Closed
return42 opened this issue Sep 17, 2021 · 0 comments · Fixed by #331
Closed

make data.all results in NameError: name 'logger' is not defined #328

return42 opened this issue Sep 17, 2021 · 0 comments · Fixed by #331
Labels
bug Something isn't working

Comments

@return42
Copy link
Member

return42 commented Sep 17, 2021

Some of the scripts in searx_extra/update/ are using searx/engines/wikidata.py but do not inject a logger before calling functions from wikidata.py

Traceback (most recent call last):
  File "searx_extra/update/update_osm_keys_tags.py", line 205, in <module>
    'keys': optimize_keys(get_keys()),
  File "searx_extra/update/update_osm_keys_tags.py", line 99, in get_keys
    response = send_wikidata_query(SPARQL_KEYS_REQUEST)
  File "searx/searx/engines/wikidata.py", line 137, in send_wikidata_query
    logger.debug('request time %s', str(http_response.elapsed))
NameError: name 'logger' is not defined
ERROR: data.osm_keys_tags exit with error (1)
DATA      update searx/data/wikidata_units.json
Traceback (most recent call last):
  File "searx_extra/update/update_wikidata_units.py", line 54, in <module>
    json.dump(get_data(), f, indent=4, ensure_ascii=False)
  File "searx_extra/update/update_wikidata_units.py", line 39, in get_data
    response = send_wikidata_query(SARQL_REQUEST)
  File "/800GBPCIex4/share/searx/searx/engines/wikidata.py", line 137, in send_wikidata_query
    logger.debug('request time %s', str(http_response.elapsed))
NameError: name 'logger' is not defined

Related-to: #296 / #305

@return42 return42 added the bug Something isn't working label Sep 17, 2021
return42 added a commit to return42/searxng that referenced this issue Sep 17, 2021
To test use::

    ./manage pyenv.cmd searx_extra/update/update_currencies.py
    ./manage pyenv.cmd searx_extra/update/update_engine_descriptions.py
    ./manage pyenv.cmd searx_extra/update/update_osm_keys_tags.py
    ./manage pyenv.cmd searx_extra/update/update_wikidata_units.py

The script `update_engine_descriptions.py` seems to have some issues not related
to this patch.

    ./manage pyenv.cmd python -m pip install -U pycld3
    ./manage pyenv.cmd searx_extra/update/update_engine_descriptions.py

Closes: searxng#328
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this issue Sep 17, 2021
To test use::

    ./manage pyenv.cmd searx_extra/update/update_currencies.py
    ./manage pyenv.cmd searx_extra/update/update_osm_keys_tags.py
    ./manage pyenv.cmd searx_extra/update/update_wikidata_units.py

The script `update_engine_descriptions.py` seems to have some issues not related
to this patch.

    ./manage pyenv.cmd python -m pip install -U pycld3
    ./manage pyenv.cmd searx_extra/update/update_engine_descriptions.py

Closes: searxng#328
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
@dalf dalf closed this as completed in #331 Sep 19, 2021
dalf pushed a commit that referenced this issue Sep 19, 2021
…331)

* [fix] searx_extra/update scripts: set_loggers(wikidata, 'wikidata')

To test use::

    ./manage pyenv.cmd searx_extra/update/update_currencies.py
    ./manage pyenv.cmd searx_extra/update/update_osm_keys_tags.py
    ./manage pyenv.cmd searx_extra/update/update_wikidata_units.py

The script `update_engine_descriptions.py` seems to have some issues not related
to this patch.

    ./manage pyenv.cmd python -m pip install -U pycld3
    ./manage pyenv.cmd searx_extra/update/update_engine_descriptions.py

Closes: #328
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant