Skip to content

4chan Processor Crashes when launching 8kun - Flask Error #218

Description

@RMcCreesh

When attempting to launch the Fask command I get the following error

ryan@ryan-virtual-machine:~/4cat$ FLASK_APP=webtool flask run
 * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
 * Serving Flask app "webtool"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Traceback (most recent call last):
  File "/home/ryan/.local/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 966, in main
    cli.main(prog_name="python -m flask" if as_module else None)
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 848, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 305, in __init__
    self._load_unlocked()
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 330, in _load_unlocked
    self._app = rv = self.loader()
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 388, in load_app
    app = locate_app(self, import_name, name)
  File "/home/ryan/.local/lib/python3.8/site-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/home/ryan/4cat/webtool/__init__.py", line 84, in <module>
    import webtool.access
  File "/home/ryan/4cat/webtool/access.py", line 21, in <module>
    from webtool.api_tool import limiter
  File "/home/ryan/4cat/webtool/api_tool.py", line 17, in <module>
    import backend
  File "/home/ryan/4cat/common/lib/../../backend/__init__.py", line 7, in <module>
    all_modules = ModuleCollector()
  File "/home/ryan/4cat/common/lib/module_loader.py", line 49, in __init__
    self.load_modules()
  File "/home/ryan/4cat/common/lib/module_loader.py", line 95, in load_modules
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/ryan/4cat/common/lib/../../datasources/eightkun/search_8kun.py", line 4, in <module>
    from datasources.fourchan.search_4chan import Search4Chan
  File "/home/ryan/4cat/common/lib/../../datasources/fourchan/search_4chan.py", line 17, in <module>
    class Search4Chan(SearchWithScope):
  File "/home/ryan/4cat/common/lib/../../datasources/fourchan/search_4chan.py", line 44, in Search4Chan
    "options": {b: b for b in config.DATASOURCES[prefix].get("boards", [])},
KeyError: '4chan'

When I tried working around it by renaming 4chan prefixes to 8kun the previous error was skipped and presented with the following;

Backend log presents ;

Tue Dec 21 01:05:18 2021: Processing '8kun-search' started for dataset cbdb44eaa7b46697db9cf62d2e309925
Tue Dec 21 01:05:18 2021: Processing data
Tue Dec 21 01:05:18 2021: Processor crashed ('4chan'), trying again later

the only error message in the console I'm being presented is;

Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
/home/ryan/.local/lib/python3.8/site-packages/flask/sessions.py:208: UserWarning: "localhost" is not a valid cookie domain, it must contain a ".". Add an entry to your hosts file, for example "localhost.localdomain", and use that instead.
  warnings.warn(

Update ;

After modying 4chan search Prefix and SQL database from 4chan to 8kun it now launches, however the backend daemon cannot connect to 'localhost' psql database, connection refused.

OG: 4CAT Started
LOG: Local API listening for requests at localhost:4444
LOG: Running processor 8kun-search on dataset 1ddeac1d4302a2cae950aa7697be375d
LOG: Querying: {'board': 'qresearch', 'body_match': '', 'subject_match': 'Qanon', 'country_name': '', 'search_scope': 'full-threads', 'min_date': 1610323200, 'max_date': 1610928000, 'user': 'autologin', 'datasource': '8kun', 'type': '8kun-search', 'pseudonymise': True, 'label': '8kun'}
LOG: Processor 8kun-search raised OperationalError while processing dataset 1ddeac1d4302a2cae950aa7697be375d in search.py:71->search.py:374->search_4chan.py:544->search_4chan.py:660->search_4chan.py:709->database_mysql.py:32->connections.py:327->connections.py:629:
   (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions