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