Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got an error "AttributeError: 'str' object has no attribute 'name'" when using the "--sqldump SQLDUMP". #221

Closed
darwin-xu opened this issue Oct 9, 2023 · 2 comments

Comments

@darwin-xu
Copy link

I encountered the error:

dxu@remotedev-dxu-sea:~/open-source/pytm> ./tm.py --sqldump SQLDUMP
Traceback (most recent call last):
  File "./tm.py", line 127, in <module>
    tm.process()
  File "/ifs/home/dxu/open-source/pytm/pytm/pytm.py", line 1055, in process
    self.sqlDump(result.sqldump)
  File "/ifs/home/dxu/open-source/pytm/pytm/pytm.py", line 1149, in sqlDump
    for k, v in serialize(e).items():
  File "/ifs/home/dxu/open-source/pytm/pytm/pytm.py", line 1873, in serialize
    value = [v.id if isinstance(v, Finding) else v.name for v in value]
  File "/ifs/home/dxu/open-source/pytm/pytm/pytm.py", line 1873, in <listcomp>
    value = [v.id if isinstance(v, Finding) else v.name for v in value]
AttributeError: 'str' object has no attribute 'name'

Is it a mistake on my end, or could it be a bug?

@raphaelahrens
Copy link
Contributor

Hi,

it looks like you have an Iterable which holds a string as a value.
Without the tm.py it is difficult to see the exact problem, but the line which fails is taking a list, tuple or iterator and the values in the iterable need to be Findinds or have a name attribute.

Without an example it is difficult to see if this is a usability issue or not.

@sergebelokamen
Copy link

sergebelokamen commented Apr 18, 2024

I am having the same issue.
The issue can be replicated with the 'tm.py' file that comes with default installation.

The issue appears to be triggered by 'assumptions' (tm.assumptions = ["No assumptions."]).
Removing or commenting the line out generates SQLite DB...

@izar izar closed this as completed in 9c90a25 Apr 18, 2024
izar added a commit that referenced this issue Apr 18, 2024
Fixed #221 Got an error "AttributeError: 'str' ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants