code4romania / czl-scrape

99 problems, but a scrape ain't one.
http://cezicelegea.ro/
Mozilla Public License 2.0
13 stars 20 forks source link

[Externe] Scraper fails if logging directory is not created first #60

Closed margelatu closed 7 years ago

margelatu commented 7 years ago

Running the scraper aka Eusebiu on a clean slate results in:

  File "eusebiu.py", line 97, in <module>
    get_to_work()

  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click-6.7-py3.6.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "eusebiu.py", line 23, in get_to_work
    format='%(asctime)s %(levelname)s %(message)s')
  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/logging/__init__.py", line 1776, in basicConfig
    h = FileHandler(filename, mode)
  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/logging/__init__.py", line 1025, in __init__
    StreamHandler.__init__(self, self._open())
  File "/Users/imargela/.pyenv/versions/3.6.0/lib/python3.6/logging/__init__.py", line 1054, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/imargela/Work/projects/code4ro/czl-scrape/externe/logs/scraper.log'

Workaround is to create the logs directory first.

rares-urdea commented 7 years ago

Addressed with: https://github.com/code4romania/czl-scrape/pull/75

margelatu commented 7 years ago

Confirmed, fixed with #75 .