我按照这个例子:https : //github.com/Day8/re-frame/blob/master/docs/FAQs/PollADatabaseEvery60.md
这是我的间隔处理程序
(defonce interval-handler
(fn [{:keys [action id frequency event]}]
(let [live-intervals (atom {})]
(condp = action
:start (swap! live-intervals assoc id (js/setInterval #(re-frame/dispatch event) frequency))
:end (do (js/clearInterval (get live-intervals id))
(swap! live-intervals dissoc id))))))
(re-frame/reg-fx
:interval
interval-handler)
Run Code Online (Sandbox Code Playgroud)
我正在尝试从此处的另一个事件发送此间隔事件:
(re-frame/reg-event-db
:start-playing
(fn [db _]
(re-frame/dispatch [:interval {:action :start
:id :some-awesome-id
:frequency 1000
:event [:tick]}])
(assoc db :is-playing? true
:fake (random-active-color db)
:real (random-active-color db))))
Run Code Online (Sandbox Code Playgroud)
但它说 re-frame: no :event handler registered for: :interval
这是不可能的吗?
为了演示我遇到的问题,我将使用这个简单的函数,该函数位于/Users/X/Code/python/example/start.py:
def say_hello(name):
print("Saying hello to {}".format(name))
say_hello("John")
Run Code Online (Sandbox Code Playgroud)
我pipenv用来设置程序包和环境。在此文件夹(旁start.py),我还有其他四个文件- ,,Pipfile 和。Pipfile.lock.envlog.txt
当我运行时pipenv run python start.py,一切正常,我得到了输出。
现在,我希望此脚本每分钟运行一次,所以我使用设置了一个cron作业crontab -e,这是我最初在其中所拥有的:
* * * * * /usr/local/bin/pipenv run python /Users/X/Code/python/example/start.py >> /Users/X/Code/python/example/log.txt 2>&1
这给了我该log.txt文件中的错误转储:
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps.
This system lists a couple of UTF-8 supporting locales that
you …Run Code Online (Sandbox Code Playgroud)