Comments (9)
我也是这个问题,刚想提BUG
1、报错pemtest.pem不存在
2、我生成了一个,但读不到
报错和楼主一致
from python-sdk.
1楼的报错缺乏环境和配置详情,看不出问题所在。应反馈是什么操作命令,产生的全错误堆栈是怎样的,以及确认是否指定的pem文件存在,或者请检查bcos3sdk的配置文件如bcos3_sdk_config.ini里ca_path路径和sdk_key文件名是否匹配
2楼的错误截图1是pem文件不存在,请检查是否文件真的不存在。
截图2已经通过了加载私钥文件的步骤了。抛出的错误是在初始化sdk时,加载某些文件的location unknown, 请检查bcos3sdk的配置文件如bcos3_sdk_config.ini里ca_path的路径和各文件名是否匹配
from python-sdk.
使用未修改的pem文件。
pem文件如下:
-----BEGIN PRIVATE KEY-----
MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgujuRXo4gOF9E/4pOxlS+
XmpZF7DoKriXtlBL+R3+0uGhRANCAAQg/rO8H8195COCdwduRksUrHtegE62jsnq
TxhjAat5fZrrZbrlRj27LWkgSfx3eqVQB0ZDpiQsB7ckV8h4WdTe
-----END PRIVATE KEY-----
报错:
root@ubuntu:~/fisco/python-sdk# python ./console3.py deploy HelloWorld
INFO >> user input : ['deploy', 'HelloWorld']
BCOS3 Deploy start------------->
user input: ['HelloWorld']
init_sdk: {self.config.bcos3lib_config_file}
init_sdk: {self.config.bcos3_lib_path}
ERROR >> execute deploy failed
ERROR >> error information: START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
若将换行符换为/r/n
pem文件如下:
-----BEGIN PRIVATE KEY-----\r\nMIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgujuRXo4gOF9E/4pOxlS+\r\nXmpZF7DoKriXtlBL+R3+0uGhRANCAAQg/rO8H8195COCdwduRksUrHtegE62jsnq\r\nTxhjAat5fZrrZbrlRj27LWkgSfx3eqVQB0ZDpiQsB7ckV8h4WdTe-----END PRIVATE KEY-----
报错:
root@ubuntu:~/fisco/python-sdk# python ./console3.py deploy HelloWorld
INFO >> user input : ['deploy', 'HelloWorld']
BCOS3 Deploy start------------->
user input: ['HelloWorld']
exception happened!
Traceback (most recent call last):
File "/root/fisco/python-sdk/./console3.py", line 140, in main
console_run_byname(modulename, classname, cmd, inputparams)
File "/root/fisco/python-sdk/console_utils/console_common.py", line 71, in console_run_byname
return console_run(obj, cmd, inputparams)
File "/root/fisco/python-sdk/console_utils/console_common.py", line 91, in console_run
func(inputparams)
File "/root/fisco/python-sdk/console_utils/cmd_bcos3_transaction.py", line 64, in deploy
tx_client = Bcos3Client()
File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 57, in init
self.init(client_config_instance)
File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 74, in init
self.init_sdk()
File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 82, in init_sdk
self.load_default_account()
File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 108, in load_default_account
self.default_from_account_signer = Signer_ECDSA.from_key_file(
File "/root/fisco/python-sdk/client/signer_impl.py", line 136, in from_key_file
account = Signer_ECDSA.load_from_keyfile(the_key_file, password)
File "/root/fisco/python-sdk/client/signer_impl.py", line 162, in load_from_keyfile
return Signer_ECDSA.load_from_pem(filename)
File "/root/fisco/python-sdk/client/signer_impl.py", line 145, in load_from_pem
key = SigningKey.from_pem(p)
File "/root/anaconda3/envs/federated_architecture/lib/python3.9/site-packages/ecdsa/keys.py", line 964, in from_pem
return cls.from_der(
File "/root/anaconda3/envs/federated_architecture/lib/python3.9/site-packages/ecdsa/keys.py", line 1034, in from_der
s, empty = der.remove_sequence(s)
File "/root/anaconda3/envs/federated_architecture/lib/python3.9/site-packages/ecdsa/der.py", line 147, in remove_sequence
raise UnexpectedDER("Empty string does not encode a sequence")
ecdsa.der.UnexpectedDER: Empty string does not encode a sequence
其他配置文件均正确,同样的流程在本地mac使用未修改的pem可以全流程正常运行,但在Ubuntu 16.04 LTS 服务器上出现了这样的问题,个人理解是在不同环境下换行符不一致导致pem读取出现错误。 python环境为3.7 其他全流程均按照教程。
PS: pem文件放置 这个步骤建议在教程中有所体现
from python-sdk.
使用未修改的pem文件。 pem文件如下: -----BEGIN PRIVATE KEY----- MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgujuRXo4gOF9E/4pOxlS+ XmpZF7DoKriXtlBL+R3+0uGhRANCAAQg/rO8H8195COCdwduRksUrHtegE62jsnq TxhjAat5fZrrZbrlRj27LWkgSfx3eqVQB0ZDpiQsB7ckV8h4WdTe -----END PRIVATE KEY-----
报错: root@ubuntu:~/fisco/python-sdk# python ./console3.py deploy HelloWorld
INFO >> user input : ['deploy', 'HelloWorld']
BCOS3 Deploy start-------------> user input: ['HelloWorld'] init_sdk: {self.config.bcos3lib_config_file} init_sdk: {self.config.bcos3_lib_path} ERROR >> execute deploy failed ERROR >> error information: START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
若将换行符换为/r/n pem文件如下: -----BEGIN PRIVATE KEY-----\r\nMIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgujuRXo4gOF9E/4pOxlS+\r\nXmpZF7DoKriXtlBL+R3+0uGhRANCAAQg/rO8H8195COCdwduRksUrHtegE62jsnq\r\nTxhjAat5fZrrZbrlRj27LWkgSfx3eqVQB0ZDpiQsB7ckV8h4WdTe-----END PRIVATE KEY-----
报错: root@ubuntu:~/fisco/python-sdk# python ./console3.py deploy HelloWorld
INFO >> user input : ['deploy', 'HelloWorld']
BCOS3 Deploy start-------------> user input: ['HelloWorld'] exception happened! Traceback (most recent call last): File "/root/fisco/python-sdk/./console3.py", line 140, in main console_run_byname(modulename, classname, cmd, inputparams) File "/root/fisco/python-sdk/console_utils/console_common.py", line 71, in console_run_byname return console_run(obj, cmd, inputparams) File "/root/fisco/python-sdk/console_utils/console_common.py", line 91, in console_run func(inputparams) File "/root/fisco/python-sdk/console_utils/cmd_bcos3_transaction.py", line 64, in deploy tx_client = Bcos3Client() File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 57, in init self.init(client_config_instance) File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 74, in init self.init_sdk() File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 82, in init_sdk self.load_default_account() File "/root/fisco/python-sdk/bcos3sdk/bcos3client.py", line 108, in load_default_account self.default_from_account_signer = Signer_ECDSA.from_key_file( File "/root/fisco/python-sdk/client/signer_impl.py", line 136, in from_key_file account = Signer_ECDSA.load_from_keyfile(the_key_file, password) File "/root/fisco/python-sdk/client/signer_impl.py", line 162, in load_from_keyfile return Signer_ECDSA.load_from_pem(filename) File "/root/fisco/python-sdk/client/signer_impl.py", line 145, in load_from_pem key = SigningKey.from_pem(p) File "/root/anaconda3/envs/federated_architecture/lib/python3.9/site-packages/ecdsa/keys.py", line 964, in from_pem return cls.from_der( File "/root/anaconda3/envs/federated_architecture/lib/python3.9/site-packages/ecdsa/keys.py", line 1034, in from_der s, empty = der.remove_sequence(s) File "/root/anaconda3/envs/federated_architecture/lib/python3.9/site-packages/ecdsa/der.py", line 147, in remove_sequence raise UnexpectedDER("Empty string does not encode a sequence") ecdsa.der.UnexpectedDER: Empty string does not encode a sequence
其他配置文件均正确,同样的流程在本地mac使用未修改的pem可以全流程正常运行,但在Ubuntu 16.04 LTS 服务器上出现了这样的问题,个人理解是在不同环境下换行符不一致导致pem读取出现错误。 python环境为3.7 其他全流程均按照教程。
PS: pem文件放置 这个步骤建议在教程中有所体现
ERROR >> error information: START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
这段异常看起来是在bcoscsdk的boost代码里抛出的,大概意思应该是对传入的bcos3_sdk_config.ini配置文件解析,并加载cert->sdk_key = sdk.key 这个文件时找不到对应的路径而出错。
和load_default_key时对应的pem文件关系不大。
建议再对一下配置文件和实际的key文件的路径,权限等信息。
from python-sdk.
bcos3_sdk_config.ini 里的证书文件路径配置和权限,这个早就检查过啦。都是有效的绝对路径,但不是十分确定配置是否正确。还是报错这个问题:ERROR >> error information: START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
from python-sdk.
配置了ca_path之后,后面的几个文件不需要再带绝对路径,只需要文件名
bcos3_sdk_config.ini 里的证书文件路径配置和权限,这个早就检查过啦。都是有效的绝对路径,但不是十分确定配置是否正确。还是报错这个问题:ERROR >> error information: START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
配置了ca_path之后,后面的几个文件不需要再带绝对路径,只需要配文件名。即:在ca_path下的xxx文件
在加载文件的时候,会用ca_path和文件名如sdk_key配置的路径做连接,然后加载,都配置了绝对路径,就找不到了
后续这个地方会优化提示和加载、报错逻辑
from python-sdk.
明白了,已验证解决
from python-sdk.
谢谢
from python-sdk.
配置文件使用方式issue,已经记录并安排优化
from python-sdk.
Related Issues (20)
- 想问一下只有一个account么,webase平台创建的账户怎么才能弄成py-sdk下的account呢 HOT 2
- [parsimonious 合适版本问题] 当前版本的Python-sdk 在合约调用的参数解析,以及对节点返回结果的解析都存在问题。 HOT 2
- 【新版合约部署问题】合约部署报错信息有未安装的环境 HOT 2
- python-sdk 跑demo_get.py报错 HOT 9
- 使用过程的报错 HOT 6
- 也请更新(升级)Python_SDK 所依赖 solc (Solidity 编译器) HOT 1
- 执行pip install -r requirements.txt 命令报错 HOT 2
- win10 安装python-sdk报错 HOT 2
- console2.py执行报错 HOT 1
- 部署合约提示错误 HOT 2
- console3.py CONSENSUS cmd error HOT 3
- 部署合约出现问题 HOT 1
- 运行demo代码时出现问题 HOT 1
- 部署了contracts文件夹下的KVTableTest合约,发起交易失败 HOT 4
- Python SDK不能插入 HOT 6
- 运行testclient.py报错 HOT 1
- 代码有错误 HOT 1
- parsimonious库有冲突 HOT 1
- console2.py execute rpc command error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-sdk.