2017-05-22 54 views
0

這是我第一次嘗試運行Python腳本。錯誤:運行Python腳本時太少的參數

我嘗試從genesis.json提示命令啓動pgeth.py

我得到這個錯誤: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

你能告訴我們你的'pgeth.py'腳本的內容嗎? – errata

+0

請看看,我編輯了這個問題。 – user5953665

回答

0

至於我可以告訴大家,通過閱讀source code of pgeth.py,參數被稱爲init不是-init,像這樣運行你的腳本不會遇到任何問題:

python pgeth.py init