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

graphml2csv - "'NoneType' object has no attribute 'encode'" #155

Open
ms-transalis opened this issue Aug 19, 2021 · 2 comments
Open

graphml2csv - "'NoneType' object has no attribute 'encode'" #155

ms-transalis opened this issue Aug 19, 2021 · 2 comments

Comments

@ms-transalis
Copy link

If a vertex/node in GraphML has a Key defined but no value, the Python script errors with the message:
"'NoneType' object has no attribute 'encode'".

The following Node can't be processed:

 <node id="#26:2">
      <data key="labelV">Document</data>
      <data key="searchname"/>
      <data key="sendername"/>
      <data key="startdate"/>
      <data key="deliverydate"/>
      <data key="search"/>
      <data key="documentid"/>
      <data key="id"/>
      <data key="idfrom"/>
      <data key="transmittimestamp"/>
      <data key="searchlocationcode"/>
      <data key="documentdatefrom"/>
      <data key="tagid"/>
      <data key="idto"/>
      <data key="format"/>
      <data key="deliverydateto"/>
      <data key="documenttype">Order</data>
      <data key="deliverydatefrom"/>
      <data key="receivername"/>
      <data key="filegennumber"/>
      <data key="documentdateto"/>
      <data key="senderid"/>
      <data key="enddate"/>
      <data key="receiverid"/>
      <data key="searchcode"/>
      <data key="documentnumber"/>
      <data key="documentdate"/>
      <data key="searchdeliverydate"/>
    </node>
@ms-transalis
Copy link
Author

Fixed by changing:

GraphML2CSV.py_compat_str(encoding, data.text)

to:

GraphML2CSV.py_compat_str(encoding, data.text or "")

@krlawrence
Copy link
Contributor

I'm going to reopen this as this looks like something we should fix in the tool. I don't think it is very common for a GraphML file to have a key element with no child, but given sparse data is allowed, the tool should still handle it gracefully. Thanks for highlighting the line in question @ms-transalis .

@krlawrence krlawrence reopened this Aug 19, 2021
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

2 participants