Skip to content

name 'basestring' is not defined error #5

@sachinruk

Description

@sachinruk

Trying to follow the examples given and when I do the following:

graph = graphcommons.graphs('7141da86-2a40-4fdc-a7ac-031b434b9653')
print(graph.name)  # Hello from python

for node in graph.nodes:
    print(node.name)

    print(graph.edges_from(node))  # edges directed from the node
    print(graph.edges_to(node))  # edges directed to the node

I get the error:

NameError                                 Traceback (most recent call last)
<ipython-input-11-21cf3ee15191> in <module>()
      5     print(node.name)
      6
----> 7     print(graph.edges_from(node))  # edges directed from the node
      8     print(graph.edges_to(node))  # edges directed to the node

/Users/sachin/anaconda/lib/python3.5/site-packages/graphcommons.py in edges_from(self, node)
     49
     50     def edges_from(self, node):
---> 51         return self.edges_for(node, 'from')
     52
     53     def edges_to(self, node):

/Users/sachin/anaconda/lib/python3.5/site-packages/graphcommons.py in edges_for(self, node, direction)
     42
     43     def edges_for(self, node, direction):
---> 44         if isinstance(node, basestring):
     45             node = self.get_node(node)
     46

NameError: name 'basestring' is not defined

I am using python 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions