Commits

Takeshi Komiya committed bb84b05

* Raise error for PDF exportion without reportlab

Comments (0)

Files changed (1)

blockdiag/sphinxcontrib/blockdiag.py

     if format not in ('PNG', 'PDF'):
         raise BlockdiagError('blockdiag error:\nunknown format: %s\n' % format)
 
+    if format == 'PDF':
+        try:
+            import reportlab
+        except ImportError:
+            msg = 'blockdiag error:\n' + \
+                  'colud not output PDF format; Install reportlab\n'
+            raise BlockdiagError(msg)
+
     hashkey = code.encode('utf-8') + str(options)
     fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format.lower())
     if hasattr(self.builder, 'imgpath'):