TypeError: __init__() got an unexpected keyword argument 'num_workers'
See original GitHub issueHi, i’ve just started getting to grips with Nornir. I have created the config.yaml, hosts.yaml and groups.yaml files in notepad++ and have only have these 3 lines of code to start with in python:
from nornir import InitNornir
nr = InitNornir(config_file="C:/Users/<REMOVED>/Desktop/config.yaml")
nr.filter(site="uk").inventory.hosts.keys()
I’m getting these errors:
Traceback (most recent call last):
File "C:/Users/<REMOVED>/PycharmProjects/test_project/nornir_test.py", line 7, in <module>
nr = InitNornir(
File "C:\Users\<REMOVED>\PycharmProjects\test_project\venv\lib\site-packages\nornir\init_nornir.py", line 66, in InitNornir
config = Config.from_dict(**kwargs)
File "C:\Users\<REMOVED>\PycharmProjects\test_project\venv\lib\site-packages\nornir\core\configuration.py", line 279, in from_dict
core=CoreConfig(**core or {}),
TypeError: __init__() got an unexpected keyword argument 'num_workers'
My config.yaml file looks like this:
---
core:
num_workers: 10
inventory:
plugin: nornir.plugins.inventory.simple.SimpleInventory
options:
host_file: "C:/Users/<REMOVED>/Desktop/hosts.yaml"
groups_file: "C:/Users/<REMOVED>/Desktop/groups.yaml"
I have even tried starting it without the config file:
from nornir import InitNornir
nr = InitNornir(
core={"num_workers": 100},
inventory={
"plugin": "nornir.plugins.inventory.simple.SimpleInventory",
"options": {
"host_file": "inventory/hosts.yaml",
"group_file": "inventory/groups.yaml"
}
}
)
But STILL nothing, this isn’t something stupid “Windows thing” is it because quite frankly i’m baffled at the moment.
Any help with this would be much appreciated, go easy i’m just a newbie with Nornir
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Why got an unexpected keyword argument 'num_workers' with ...
I have this Traceback TypeError: __init__() got an unexpected keyword argument 'num_workers'. – Aleksey. Dec 14, 2020 at 14:17.
Read more >TypeError:__init__() got an unexpected keyword argument ...
Describe the bug. I use the UNETR/BTCV code to complete multi organ segmentation, but in Dataloader, I get this Error: TypeError:init() got ......
Read more >TypeError: __init__() got an unexpected keyword argument ...
Hi, I have followed the steps given in the chapter to set up mflix app. ... TypeError: init() got an unexpected keyword argument...
Read more >init__() got an unexpected keyword argument 'max_iter'?
TypeError : init() got an unexpected keyword argument 'max_iter'. I m running the linear regression code in Community edition. Google says reinstall --....
Read more >TypeError: __init__() got an unexpected ... - PyTorch Forums
Hi why I have this error? worker_info.dataset.setup_augmentor(worker_id, ... TypeError: init() got an unexpected keyword argument 'seed'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, it was the version. On PyCharm i checked the version and it 100% said 2.4.0 but looking at it further it was the latest build i downloaded. The way PyCharms interface looks it genuinely did look like i’d downloaded 2.4.0 because when i clicked on Nornir it has it right next to it while looking for version details. Thanks again though, you guys are awesome.
I did look at the code and your error to be 100% sure and look at this error:
However, that file in
2.4.0only has 140 lines:https://github.com/nornir-automation/nornir/blob/v2.4.0/nornir/core/configuration.py
Also, that
from_dictmethod was introduced recently in nornir3 (which is in alpha and you shouldn’t be using yet 😃 )