oxwhirl / pymarl

Python Multi-Agent Reinforcement Learning framework
Apache License 2.0
1.89k stars 387 forks source link

AttributeError: 'NoneType' object has no attribute 'items' #129

Open suleiman1122 opened 2 years ago

suleiman1122 commented 2 years ago

Hi, when I run the code from ubuntu 20 python 3.6 I got this error

File "src/main.py", line 88, in config_dict = recursive_dict_update(config_dict, alg_config) File "src/main.py", line 56, in recursive_dict_update for k, v in u.items(): AttributeError: 'NoneType' object has no attribute 'items'

bayzhen commented 2 years ago

me,too

8uttonwoodRL commented 1 year ago

Do you Solved it

suleiman1122 commented 1 year ago

Hi

I run the code on linex and it work but windows still have a lot of issues.

Best regards Suleiman

On Dec 18, 2022, at 4:54 PM, 8uttonwoodRL @.***> wrote:



Do you Solved it

— Reply to this email directly, view it on GitHubhttps://github.com/oxwhirl/pymarl/issues/129#issuecomment-1356680549, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP6S2HJDNUFWNAUMUKP3H3DWN2RH3ANCNFSM5OMYAYVA. You are receiving this because you authored the thread.Message ID: @.***>

qxy-commits commented 5 months ago

Learn about the sys.argv command from this website: https://blog.csdn.net/Kim_Weir/article/details/103875186 You can think of argv as a list, the first element is the location of main.py, followed by the external parameters. params = deepcopy(sys.argv) This command receives parameters entered from the terminal, for example python3 src/main.py --config=qmix --env-config=sc2 with env_args.map_name=2s3z So, when you click the debug or run button directly in pycharm, there is only one element in the argv list, which is the location of main.py. So params is wrong at this time. So the result of env_config = _get_config(params, "sc2", "envs") is also wrong. So the input parameter "env_config" of config_dict = recursive_dict_update(config_dict, env_config) is also wrong. So the recursive_dict_update function will report an error. I changed it to the following form. This form needs to be changed in the corresponding position in the code when changing the environment, map, and algorithm.

env_config = _get_config(params, "sc2", "envs") def _get_config(params, arg_name, subfolder): config_name = arg_name if config_name is not None: with open(os.path.join(os.path.dirname(file), "config", subfolder, "{}.yaml".format(config_name)), "r") as f: try: config_dict = yaml.load(f) except yaml.YAMLError as exc: assert False, "{}.yaml error: {}".format(config_name, exc) return config_dict