diff options
| author | aric <none@none> | 2010-08-11 02:52:09 +0000 |
|---|---|---|
| committer | aric <none@none> | 2010-08-11 02:52:09 +0000 |
| commit | d647bccbd1c75b4829e77e630165cd25c77cef82 (patch) | |
| tree | a900cd85b03d80de6dfd99182e8668889bce761b /networkx | |
| parent | fa1231df3f54f35c7ba4166d0a9932eab6d2c57d (diff) | |
| download | networkx-d647bccbd1c75b4829e77e630165cd25c77cef82.tar.gz | |
Check to see if we can get pyparsing from matplotlib.
Fixes #398
--HG--
extra : convert_revision : svn%3A3ed01bd8-26fb-0310-9e4c-ca1a4053419f/networkx/trunk%401905
Diffstat (limited to 'networkx')
| -rw-r--r-- | networkx/readwrite/gml.py | 23 | ||||
| -rw-r--r-- | networkx/readwrite/tests/test_gml.py | 5 |
2 files changed, 22 insertions, 6 deletions
diff --git a/networkx/readwrite/gml.py b/networkx/readwrite/gml.py index 902808ed..8ac39123 100644 --- a/networkx/readwrite/gml.py +++ b/networkx/readwrite/gml.py @@ -108,8 +108,11 @@ def parse_gml(lines): try: from pyparsing import ParseException except ImportError: - raise ImportError(\ - """Import Error: not able to import pyparsing: + try: + from matplotlib.pyparsing import ParseException + except: + raise ImportError(\ + """Import Error: not able to import pyparsing: http://pyparsing.wikispaces.com/""") try: @@ -192,8 +195,15 @@ def pyparse_gml(): ParseException, restOfLine, White, alphas, alphanums, nums,\ OneOrMore,quotedString,removeQuotes,dblQuotedString except ImportError: - raise ImportError(\ - """Import Error: not able to import pyparsing: + try: + from matplotlib.pyparsing import \ + Literal, CaselessLiteral, Word, Forward,\ + ZeroOrMore, Group, Dict, Optional, Combine,\ + ParseException, restOfLine, White, alphas, alphanums, nums,\ + OneOrMore,quotedString,removeQuotes,dblQuotedString + except: + raise ImportError(\ + """Import Error: not able to import pyparsing: http://pyparsing.wikispaces.com/""") if not graph: @@ -343,4 +353,7 @@ def setup_module(module): try: import pyparsing except: - raise SkipTest("pyparsing not available") + try: + import matplotlib.pyparsing + except: + raise SkipTest("pyparsing not available") diff --git a/networkx/readwrite/tests/test_gml.py b/networkx/readwrite/tests/test_gml.py index 6aa9864e..285167b1 100644 --- a/networkx/readwrite/tests/test_gml.py +++ b/networkx/readwrite/tests/test_gml.py @@ -12,7 +12,10 @@ class TestGraph(object): try: import pyparsing except ImportError: - raise SkipTest('gml test: pyparsing not available.') + try: + import matplotlib.pyparsing as pyparsing + except: + raise SkipTest('gml test: pyparsing not available.') def setUp(self): self.simple_data="""Creator me |
