pydot / pydot-ng

Python interface to Graphviz's Dot language compatible with Python 2 nad Python 3
MIT License
23 stars 10 forks source link

[69] Prints to stdout if cannot load dot_parser #10

Closed prmtl closed 6 years ago

prmtl commented 9 years ago

Reported by cmr.P...@gmail.com, 2012-03-20T11:05:59Z

If dot_parser cannot be loaded in pydot, a message is printed to stdout. I believe it's incorrect. A message should be printed to stderr (as in the following patch), or not printed at all.

*** pydot.py.orig   2012-03-20 13:48:01.009730200 +0400
--- pydot.py    2012-03-20 13:48:27.784195800 +0400
***************
*** 23,28 ****
--- 23,29 ----
  __license__ = 'MIT'

  import os
+ import sys
  import re
  import subprocess
  import tempfile
***************
*** 30,36 ****
  try:
      import dot_parser
  except Exception, e:
!     print "Couldn't import dot_parser, loading of dot files will not be possible."

--- 31,37 ----
  try:
      import dot_parser
  except Exception, e:
!     print >> sys.stderr, "Couldn't import dot_parser, loading of dot files will not be possible."

Originally assigned to ero.carr...@gmail.com From: https://code.google.com/p/pydot/issues/detail?id=69

prmtl commented 9 years ago

Comment by michal.b...@gmail.com, 2013-08-02T06:51:11Z

smells like a bug, is a bug (i don't want to have unneeded module import failure message in my resulting data output)

prmtl commented 9 years ago

Comment by ero.carr...@gmail.com, 2014-03-15T16:06:26Z

Yes, the error should be printed to stderr. It will be fixed.

prmtl commented 9 years ago

Comment by ero.carr...@gmail.com, 2014-03-15T16:06:43Z

Assigned to ero.carr...@gmail.com

prmtl commented 6 years ago

Fixed in #48 by using warnings module.