Skip to content

Commit

Permalink
Fix QuantumCircuit.draw() not outputting pdf in latex mode (#10212) (#…
Browse files Browse the repository at this point in the history
…10217)

* Fix QuantumCircuit.draw() not outputting pdf in latex mode

* Added bugfix release note; moved import to the top

* Fixup release note

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
(cherry picked from commit 84d13d7)

Co-authored-by: Mu-Te Joshua Lau <71618875+JoshuaLau0220@users.noreply.github.com>
  • Loading branch information
mergify[bot] and JoshuaLau0220 authored Jun 6, 2023
1 parent d1b8c5d commit 4d5f830
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qiskit/visualization/circuit/circuit_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
import subprocess
import tempfile
import shutil
from warnings import warn

from qiskit import user_config
Expand Down Expand Up @@ -495,7 +496,7 @@ def _latex_circuit_drawer(
image = trim_image(image)
if filename:
if filename.endswith(".pdf"):
os.rename(base + ".pdf", filename)
shutil.move(base + ".pdf", filename)
else:
try:
image.save(filename)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

fixes:
- |
Fixed a regression in the LaTeX drawer of :meth:`.QuantumCircuit.draw`
when temporary files are placed on a separate filesystem to the working
directory. See
`#10211 <https://github.com/Qiskit/qiskit-terra/issues/10211>`__.

0 comments on commit 4d5f830

Please sign in to comment.