[英]How to import web3 into pyscript?
Im new to pyscript and i wan to use web3.py in my index page我是 pyscript 的新手,我想在我的索引页面中使用 web3.py
This here is my index.html page这是我的索引。html 页面
<body>
<py-env>
- web3
</py-env>
<py-script >
import web3
bsc = 'https://bsc-dataseed.binance.org/'
web3 = Web3(Web3.HTTPProvider(bsc))
print(web3.isConnected())
</py-script>
</body>
When I run this file the page is only loading but nothing is being displayed on my site.当我运行这个文件时,页面只是加载,但我的网站上没有显示任何内容。
I have installed web3 and I have tried to import it as我已经安装了 web3,并尝试将其导入为
<py-env>
- web3==5.30.0
</py-env>
same error as above与上述相同的错误
The package web3
is not compatible with PyScript because the package depends on websockets
which is not a pure Python 3 wheel and cannot be loaded by pyodide. package
web3
与 PyScript 不兼容,因为 package 依赖于websockets
,它不是纯 Python 3 轮 pyide 无法加载。
Any package that depends upon the TCP Sockets I/O APIs is not supported within a browser due to sandbox security limitations.由于沙盒安全限制,浏览器不支持任何依赖于 TCP Sockets I/O API 的 package。
The solution is to ask the web3
team to update their package, or perhaps do the updates yourself and contribute the changes.解决方案是要求
web3
团队更新他们的 package,或者自己进行更新并贡献更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.