flask-by-example
flask-by-example copied to clipboard
worker function not found
I am running the worker based on the README and get the following error after POSTing a url
$ python worker.py
22:45:34 RQ worker 'rq:worker:P6s-MacBook-Pro-2.33821' started, version 0.5.6
22:45:34
22:45:34 *** Listening on default...
22:45:46 default: __main__.count_and_save_words('http://index.hu') (aed5e21f-5b70-44c0-96d8-57845638cda0)
22:45:46 AttributeError: module '__main__' has no attribute 'count_and_save_words'
Traceback (most recent call last):
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/worker.py", line 568, in perform_job
rv = job.perform()
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/job.py", line 495, in perform
self._result = self.func(*self.args, **self.kwargs)
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/job.py", line 206, in func
return import_attribute(self.func_name)
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/utils.py", line 151, in import_attribute
return getattr(module, attribute)
AttributeError: module '__main__' has no attribute 'count_and_save_words'
Traceback (most recent call last):
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/worker.py", line 568, in perform_job
rv = job.perform()
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/job.py", line 495, in perform
self._result = self.func(*self.args, **self.kwargs)
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/job.py", line 206, in func
return import_attribute(self.func_name)
File "/Users/peetasan/dev/flask-by-example/virtualenv/lib/python3.6/site-packages/rq/utils.py", line 151, in import_attribute
return getattr(module, attribute)
AttributeError: module '__main__' has no attribute 'count_and_save_words'
22:45:46 Moving job to 'failed' queue
Which part of the tutorial are you in?
@mjhea0 I too experienced the same problem. Any hint?
Same problem here.
Yeah same issue here.
Redis also looks to be storing the information, it just looks wrong.
1) "timeout"
2) "180"
3) "result_ttl"
4) "5000"
5) "status"
6) "failed"
7) "data"
8) "\x80\x04\x95G\x00\x00\x00\x00\x00\x00\x00(\x8c\x1d__main__.count_and_save_words\x94N\x8c\x1bhttp://www.blackmonocle.com\x94\x85\x94}\x94t\x94."
9) "exc_info"
10) "Traceback (most recent call last):\n File \"/home/administrator/VM/flask-by-example/env/lib/python3.5/site-packages/rq/worker.py\", line 568, in perform_job\n rv = job.perform()\n File \"/home/administrator/VM/flask-by-example/env/lib/python3.5/site-packages/rq/job.py\", line 495, in perform\n self._result = self.func(*self.args, **self.kwargs)\n File \"/home/administrator/VM/flask-by-example/env/lib/python3.5/site-packages/rq/job.py\", line 206, in func\n return import_attribute(self.func_name)\n File \"/home/administrator/VM/flask-by-example/env/lib/python3.5/site-packages/rq/utils.py\", line 151, in import_attribute\n return getattr(module, attribute)\nAttributeError: module '__main__' has no attribute 'count_and_save_words'\n"
11) "enqueued_at"
12) "2018-06-21T14:05:23Z"
13) "description"
14) "__main__.count_and_save_words('http://www.google.com')"
15) "origin"
16) "default"
17) "ended_at"
18) "2018-06-21T14:05:24Z"
19) "ttl"
20) "-1"
21) "created_at"
22) "2018-06-21T14:05:23Z"```