这是我第一次尝试运行Python脚本。
我尝试使用提示命令从pgeth.py
启动genesis.json
。
我收到此错误:too few arguments
。
这些是我的Windows提示符cmd行上的命令:
cd to/CreatePrivateEthereum-master_Folder
python pgeth.py -init
> pgeth.py: error: too few arguments
pgeth.py
脚本的内容:
def init(args):
"""init command"""
# account management
initAccount()
# init needed if there is no chaindata dir
datadir = getDataDir()
if checkDir(os.path.join(datadir, 'chaindata')):
return
geth = checkGethCommand()
options = [ "--datadir", datadir, "--networkid", "100" ]
# create the json genesis
address = getAddress()
txt = GENESIS.replace("$ADDRESS$", address)
f = open("genesis.json", "w")
f.write(txt)
f.close()
# launch the blockchain with the CustomGenesis.json file
cmdInit = [ geth ] + options + [ "init", "genesis.json"]
logging.debug("cmd: " + strCommand(cmdInit))
subprocess.call(cmdInit)
答案 0 :(得分:0)
据我所知,通过阅读source code of pgeth.py,该参数被称为init
而非-init
,运行您的脚本不会遇到任何问题:
python pgeth.py init