Skip to content
Browse files

Silence epstopdf, this is ugly

  • Loading branch information...
1 parent a5d018e commit dc8b07f87c806af178bb1ff91578e11b24c7bb4e @GaelVaroquaux GaelVaroquaux committed
Showing with 9 additions and 4 deletions.
  1. +8 −3 pyreport/options.py
  2. +1 −1 pyreport/pyreport.py
View
11 pyreport/options.py
@@ -6,15 +6,20 @@
import copy
import os
from optparse import OptionParser
+import sys
# Local imports
from version import __version__
-def silent_execute( string):
+def silent_execute( string, return_stderr=True):
""" Execute the given shell adding '> /dev/null' if under a posix OS
and '> nul' under windows.
"""
- return os.system(string + " > " + os.devnull)
+ if sys.platform.startswith('win') or return_stderr:
+ return os.system(string + " > " + os.devnull)
+ else:
+ return os.system('%s >%s 2>%s' % (string, os.devnull,
+ os.devnull))
def verbose_execute(string):
@@ -41,7 +46,7 @@ def verbose_execute(string):
"eps" : ("eps",),
})
# Why the hell does epstopdf return 65280 !!
- if silent_execute("epstopdf --help") in (0, 65280):
+ if silent_execute("epstopdf --help", return_stderr=False) in (0, 65280):
allowed_types.update({
"pdf" : ("pdf",),
"tex" : ("pdf", "eps","ps"),
View
2 pyreport/pyreport.py
@@ -68,7 +68,7 @@ def guess_names_and_types(options, allowed_types=allowed_types):
# Find types for figures and output:
if options.outtype is None:
if options.figuretype:
- for key in allowed_types:
+ for key in allowed_types.keys():
if not options.figuretype in allowed_types[key]:
allowed_types.pop(key)
# FIXME: pdf should not be hard coded, but this should be the first

0 comments on commit dc8b07f

Please sign in to comment.
Something went wrong with that request. Please try again.