小编Dam*_*leș的帖子

如何将异步函数传递给 Python 中的线程目标?

我有以下代码:

async some_callback(args):
    await some_function()
Run Code Online (Sandbox Code Playgroud)

我需要将它作为目标提供给一个线程:

_thread = threading.Thread(target=some_callback, args=("some text"))
_thread.start()
Run Code Online (Sandbox Code Playgroud)

我得到的错误是“some_callback从未等待”。
任何想法如何解决这个问题?

python multithreading

12
推荐指数
2
解决办法
1万
查看次数

如何解决 Mac 上的 npm 安装错误

我在线购买了 Gatsby JS 网站的模板,当我尝试使用它时,它起作用了,但随后就停止了。我尝试在新目录中打开该项目,但失败了。

目前我无法运行npm install该项目,也不知道如何解决该问题。

错误消息是:

    npm ERR! code 1
    npm ERR! path /Users/chistopherholder/Desktop/react_play/rewy-gatsby-with-strapi/rewy-api/node_modules/sharp
    npm ERR! command failed
    npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
    npm ERR! info sharp Using cached /Users/chistopherholder/.npm/_libvips/libvips-8.10.0-darwin-x64.tar.br
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@3.8.0
    npm ERR! gyp info using node@14.15.5 | darwin | x64
    npm ERR! gyp info spawn /usr/bin/python2
    npm …
Run Code Online (Sandbox Code Playgroud)

npm-install

9
推荐指数
1
解决办法
1万
查看次数

如何将块数据加载到EditorJS中?

我想将块数据动态加载到我的 EditorJS 实例中。我想做这样的事情:

const editor = new EditorJS();
editor.load({ blocks: my_blocks })
Run Code Online (Sandbox Code Playgroud)

我似乎没有在https://editorjs.io/上找到任何有关如何执行此操作的文档

我知道我可以在初始化期间将块加载到 EditorJS,但我需要在单击按钮时加载动态数据。

editorjs

5
推荐指数
2
解决办法
5562
查看次数

标签 统计

editorjs ×1

multithreading ×1

npm-install ×1

python ×1