Midnighter / structurizr-python

A Python 3 port of Simon Brown's Structurizr diagrams-as-code architecture description tool.
https://structurizr.com/
Apache License 2.0
65 stars 16 forks source link

Problem with adding a person to the existing workspace #85

Closed gvelimir closed 2 years ago

gvelimir commented 2 years ago

I've been trying to integrate Structurizr into a Python script, but it seems it has some problems I could not figure out so far.

I created a dummy empty workspace on Structurizr and when trying to connect and add elements, it fails on adding a person.

Line that fails:

user = model.add_person("User", "A user of my software system.")

Error stack:

Traceback (most recent call last):
  File "/snap/pycharm-community/252/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/snap/pycharm-community/252/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/velimir/smart_voucher_selection/structurizr_init.py", line 13, in <module>
    kam_user = model.add_person("User", "A user of my software system.")
TypeError: add_person() takes from 1 to 2 positional arguments but 3 were given
python-BaseException
Midnighter commented 2 years ago

Hi there,

I am sorry that the documentation is sorely lacking. In this case, the method add_person is defined as:

def add_person(self, person=None, **kwargs)

so you either need to provide a Person instance or use keyword arguments only. Try

user = model.add_person(name="User", description="A user of my software system.")

You may find it very helpful to browse the examples, such as the financial risk system.

Midnighter commented 2 years ago

This issue looks resolved from my perspective. Please feel free to re-open if this continues to be a problem for you.