##// END OF EJS Templates
Replace usage of os.devnull with subprocess.DEVNULL
Yann Pellegrini -
Show More
@@ -160,38 +160,37 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):"
160 160 with workdir.joinpath(tmpfile).open("w", encoding="utf8") as f:
161 161 f.writelines(genelatex(s, wrap))
162 162
163 with open(os.devnull, 'wb') as devnull:
164 subprocess.check_call(
165 ["latex", "-halt-on-error", "-interaction", "batchmode", tmpfile],
166 cwd=workdir,
167 stdout=devnull,
168 stderr=devnull,
169 startupinfo=startupinfo,
170 )
171
172 resolution = round(150*scale)
173 subprocess.check_call(
174 [
175 "dvipng",
176 "-T",
177 "tight",
178 "-D",
179 str(resolution),
180 "-z",
181 "9",
182 "-bg",
183 "Transparent",
184 "-o",
185 outfile,
186 dvifile,
187 "-fg",
188 color,
189 ],
190 cwd=workdir,
191 stdout=devnull,
192 stderr=devnull,
193 startupinfo=startupinfo,
194 )
163 subprocess.check_call(
164 ["latex", "-halt-on-error", "-interaction", "batchmode", tmpfile],
165 cwd=workdir,
166 stdout=subprocess.DEVNULL,
167 stderr=subprocess.DEVNULL,
168 startupinfo=startupinfo,
169 )
170
171 resolution = round(150 * scale)
172 subprocess.check_call(
173 [
174 "dvipng",
175 "-T",
176 "tight",
177 "-D",
178 str(resolution),
179 "-z",
180 "9",
181 "-bg",
182 "Transparent",
183 "-o",
184 outfile,
185 dvifile,
186 "-fg",
187 color,
188 ],
189 cwd=workdir,
190 stdout=subprocess.DEVNULL,
191 stderr=subprocess.DEVNULL,
192 startupinfo=startupinfo,
193 )
195 194
196 195 with workdir.joinpath(outfile).open("rb") as f:
197 196 return f.read()
General Comments 0
You need to be logged in to leave comments. Login now