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

[proc-spa] TypeError: not all arguments converted during string formatting #314

Open
jfunez opened this issue Jul 16, 2018 · 0 comments
Open
Labels

Comments

@jfunez
Copy link
Contributor

jfunez commented Jul 16, 2018

Quanto tem erro gerando htmls não é possível ver o erro certo, porque é levantada outra exceção:

Exemplo:

Traceback (most recent call last):
  File ""/usr/local/lib/python2.7/site-packages/rq/worker.py"", line 768, in perform_job
    rv = job.perform()
  File ""/usr/local/lib/python2.7/site-packages/rq/job.py"", line 558, in perform
    self._result = self._execute()
  File ""/usr/local/lib/python2.7/site-packages/rq/job.py"", line 564, in _execute
    return self.func(*self.args, **self.kwargs)
  File ""/app/opac_proc/transformers/jobs.py"", line 183, in task_transform_article
    transformer.transform()
  File ""/app/opac_proc/extractors/decorators.py"", line 16, in wrapped
    extract_method(*args, **kwargs)
  File ""/app/opac_proc/transformers/tr_articles.py"", line 179, in transform
    self.transform_model_instance['htmls'] = asset_html.register_from_xml(uuid)
  File ""/app/opac_proc/core/assets.py"", line 744, in register_from_xml
    generated_htmls = self.generate_htmls(BytesIO(asset['file']))
  File ""/app/opac_proc/core/assets.py"", line 626, in generate_htmls
    logger.error(""Erro gerando o HTML: "", error)
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 1192, in error
    Log 'msg % args' with severity 'ERROR'.
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 1200, in error
    self._log(ERROR, msg, args, **kwargs)
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 1293, in _log
    self.handle(record)
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 1303, in handle
    self.callHandlers(record)
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 1343, in callHandlers
    hdlr.handle(record)
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 766, in handle
    self.emit(record)
  File ""/usr/local/lib/python2.7/site-packages/mongolog/handlers.py"", line 68, in emit
    self.collection.insert(self.format(record))
  File ""/usr/local/lib/python2.7/logging/__init__.py"", line 741, in format
    return fmt.format(record)
  File ""/usr/local/lib/python2.7/site-packages/mongolog/handlers.py"", line 22, in format
    record.msg = record.msg % record.args
TypeError: not all arguments converted during string formatting

linha que levanta a nova exceção:

File ""/app/opac_proc/core/assets.py"", line 626,

Na chamada para escrever o log.error falta "%s":

logger.error("Erro gerando o HTML: ", error)

correção

adicionar %s na mensagem de log:

logger.error("Erro gerando o HTML: %s", error)
@jfunez jfunez added the bug label Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant