Cli error occur using mpg potcar -r

Hello,everyone! I have met the error when I used cli mpg potcar -r :

(base) D:\tmp>pmg potcar -r ./
Traceback (most recent call last):
File “D:\Anaconda3\Scripts\pmg-script.py”, line 10, in
sys.exit(main())
File “D:\Anaconda3\lib\site-packages\pymatgen\cli\pmg.py”, line 294, in main
args.func(args)
File “D:\Anaconda3\lib\site-packages\pymatgen\cli\pmg_potcar.py”, line 30, in generate_potcar
proc_dir(args.spec, gen_potcar)
AttributeError: ‘Namespace’ object has no attribute ‘spec’

Who can help me for solving this problem? Thank you all!

1 Like

Hi @haoli,

Congrats, you’ve found a bug in pymatgen! I’ve submitted a patch here.

Best,
Donny

Thank you for your help,
I test it in my computer after fixing the two files you revised, it works now:

ls -R .: POTCAR.spec Subdir ./Subdir: POTCAR.spec pmg potcar -r ./
$ls -R
.:
POTCAR POTCAR.spec Subdir
./Subdir:
POTCAR POTCAR.spec

Actually, I also try to fix it,but don’t remove nargs=“+” .

Then "pmg potcar -r "can support one more directories.

$ pmg potcar -r Subdir Subdir1

$ ls -R
.:
POTCAR.spec Subdir Subdir1
./Subdir:
POTCAR POTCAR.spec
./Subdir1:
POTCAR POTCAR.spec