ndexbio / ndex-python

NDEx Python Client v3.1 - Superseded by the NDEx2 Client v1.0
2 stars 6 forks source link

NameError thrown while getting Graph Attributes #18

Closed cthoyt closed 7 years ago

cthoyt commented 7 years ago

https://github.com/ndexbio/ndex-python/blob/b2fb766b581844e8785c0abeb2a0a1b3781ce999/ndex/create_aspect.py#L62

This causes a NameError to be raised if this code is ever encountered. Example:

Traceback (most recent call last):
  File "/home/choyt/dev/indra/indra/tools/machine/machine.py", line 303, in upload_cx_to_ndex
    ndex_client.update_network(cx_str, network_id, ndex_cred)
  File "/home/choyt/dev/indra/indra/databases/ndex_client.py", line 170, in update_network
    set_style(network_id, ndex_cred)
  File "/home/choyt/dev/indra/indra/databases/ndex_client.py", line 190, in set_style
    password=password)
  File "/home/choyt/dev/ndex-python/ndex/networkn.py", line 1115, in update_to
    cx = self.to_cx()
  File "/home/choyt/dev/ndex-python/ndex/networkn.py", line 676, in to_cx
    network_attributes = ca.network_attributes(G, has_single_subnetwork)
  File "/home/choyt/dev/ndex-python/ndex/create_aspect.py", line 62, in network_attributes
    element = {'n': attribute, 'v': string(value)}
NameError: name 'string' is not defined

I believe this was a typo and should str().

agary-ucsd commented 7 years ago

Hey Charlie, I remove the string casting altogether. One of our collaborators wanted all fields to be string, but forgot to check the Python syntax. I noticed you have a pull request to add Travis CI to this project, which would have caught this bug. I'm currently looking into adding either Travis or CircleCI to all of our projects. More to come