diff --git a/src/sage/graphs/digraph_generators.py b/src/sage/graphs/digraph_generators.py index 45bf0bb7f5b..b8a6fc1cc0a 100644 --- a/src/sage/graphs/digraph_generators.py +++ b/src/sage/graphs/digraph_generators.py @@ -63,7 +63,6 @@ # http://www.gnu.org/licenses/ ################################################################################ from sage.cpython.string import bytes_to_str -from sage.env import SAGE_NAUTY_BINS_PREFIX as nautyprefix import sys from sage.misc.randstate import current_randstate @@ -528,7 +527,12 @@ def tournaments_nauty(self, n, nauty_input += " " + str(n) + " " - sp = subprocess.Popen(nautyprefix+"gentourng {0}".format(nauty_input), shell=True, + import shlex + from sage.features.nauty import NautyExecutable + gentourng_path = NautyExecutable("gentourng").absolute_filename() + + sp = subprocess.Popen(shlex.quote(gentourng_path) + " {0}".format(nauty_input), + shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) @@ -636,8 +640,13 @@ def nauty_directg(self, graphs, options="", debug=False): options += ' -q' # Build directg input (graphs6 format) - input = ''.join(g.graph6_string()+'\n' for g in graphs) - sub = subprocess.Popen(nautyprefix+'directg {0}'.format(options), + input = ''.join(g.graph6_string() + '\n' for g in graphs) + + import shlex + from sage.features.nauty import NautyExecutable + directg_path = NautyExecutable("directg").absolute_filename() + + sub = subprocess.Popen(shlex.quote(directg_path) + ' {0}'.format(options), shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,