# [Debug] 使用 Python argparse 遇到 error: unrecognized arguments ## 情境說明 我在 main.py 裡面定義了許多 argument 參數例如長這樣  然後我的 cmd.sh 長這樣 ```bash python main.py --model GaussianCopula \ --input_path data/train_raw.csv \ --output_dir data/ \ --num_rows 1000 \ --save_output \ --gen_dim 23 45 24 99 ``` 結果當我執行時 ```bash bash cmd.sh ``` 出現 command not found 錯誤 總共有兩個參數找不到 ```bash error: unrecognized arguments: zsh: command not found: --output_dir zsh: command not found: --save_output ``` 檢查了半天,確認我都有定義這兩個參數 ## 解法 結果我錯誤的原因在這裡,請見下方的圖  可以發現我在 cmd.sh 裡面寫的反斜線換行符號,在第二行跟第四行後面不小心多打了一個空白!!才造成我後面的參數吃不到 把空白刪掉即可解決! 在此筆記一下 :::success cmd.sh 裡面的換行符號 " \\ " 後面不可以有空白(space) 要直接換行(newline),避免看不到的錯誤產生! ::: 報告完畢
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up