Closed khanna7 closed 2 years ago
I can't see where the 4 arguments are coming from in:
File "/Volumes/GoogleDrive/My Drive/code/cadre/python/pycadre/cadre_person.py", line 224, in create_person return Person(nid, agent_type, rank) TypeError: Person.__init__() takes 3 positional arguments but 4 were given
Can you print the nid, agent_type, and rank in create_person?
I think I see what the issue is. Move the create_person
and restore_person
functions out of the Person class. And pass them to read_network as cadre_person.create_person
and cadre_person.restore_person
. The lack of self when those functions are in the Persons class is confusing Python I think.
Thanks @ncollier! This does seem to get closer. Couple questions:
The linked code results in the following:
nid: <built-in function id>
agent_type 0
agent_rank 0
nid: <built-in function id>
agent_type 0
agent_rank 0
nid: <built-in function id>
agent_type 0
agent_rank 0
...
The agent_type
and agent_rank
make sense, but the nid
seems to be giving an incorrect result. What might that be about?
There's a typo in the print code: print("nid: ", id)
-- id
instead of nid
. id is a built-in python function.
The following works!
Thanks so much!
https://github.com/khanna-lab/cadre/blob/1463ec215866a7c45491b2483c8ec65493b80ee5/python/pycadre/cadre_model.py#L64-L73
When I try to create a network projection in the
Model
class, as shown in the highlighted lines, I get the following error:I have a network.txt file that looks correct structurally, but I don't follow the error. Any suggestions would be most appreciated.