Show More
@@ -6,8 +6,8 b'' | |||||
6 | import subprocess |
|
6 | import subprocess | |
7 | import os |
|
7 | import os | |
8 | import sys |
|
8 | import sys | |
9 | import shutil |
|
|||
10 |
|
9 | |||
|
10 | from IPython.utils.process import find_cmd | |||
11 | from IPython.utils.traitlets import Integer, List, Bool, Instance |
|
11 | from IPython.utils.traitlets import Integer, List, Bool, Instance | |
12 | from IPython.utils.tempdir import TemporaryWorkingDirectory |
|
12 | from IPython.utils.tempdir import TemporaryWorkingDirectory | |
13 | from .latex import LatexExporter |
|
13 | from .latex import LatexExporter | |
@@ -38,11 +38,6 b' class PDFExporter(LatexExporter):' | |||||
38 |
|
38 | |||
39 | writer = Instance("IPython.nbconvert.writers.FilesWriter", args=()) |
|
39 | writer = Instance("IPython.nbconvert.writers.FilesWriter", args=()) | |
40 |
|
40 | |||
41 | def valid_on_path(self, command): |
|
|||
42 | """Ensure the given command exists in the OS PATH.""" |
|
|||
43 | if (shutil.which(command)==None) : |
|
|||
44 | raise FileNotFoundError("NBConvert requires this command to be on the System PATH: "+str(command)) |
|
|||
45 |
|
||||
46 | def run_command(self, command_list, filename, count, log_function): |
|
41 | def run_command(self, command_list, filename, count, log_function): | |
47 | """Run command_list count times. |
|
42 | """Run command_list count times. | |
48 |
|
43 | |||
@@ -72,7 +67,8 b' class PDFExporter(LatexExporter):' | |||||
72 | # could be different (cp437 in case of dos console) |
|
67 | # could be different (cp437 in case of dos console) | |
73 | command = [c.encode('cp1252') for c in command] |
|
68 | command = [c.encode('cp1252') for c in command] | |
74 |
|
69 | |||
75 | self.valid_on_path(command_list[0]) |
|
70 | # This will throw a clearer error if the command is not found | |
|
71 | find_cmd(command_list[0]) | |||
76 |
|
72 | |||
77 | times = 'time' if count == 1 else 'times' |
|
73 | times = 'time' if count == 1 else 'times' | |
78 | self.log.info("Running %s %i %s: %s", command_list[0], count, times, command) |
|
74 | self.log.info("Running %s %i %s: %s", command_list[0], count, times, command) |
General Comments 0
You need to be logged in to leave comments.
Login now