Skip to content

Commit

Permalink
Fix LaTeX drawer on split-filesystem systems (#8629)
Browse files Browse the repository at this point in the history
* Update circuit_visualization.py

Corrects issue #8542

* Update circuit_visualization.py

* Add release note

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
  • Loading branch information
jmcelroy01 and jakelishman authored Aug 29, 2022
1 parent 231961d commit d163e89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qiskit/visualization/circuit_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import logging
import os
import shutil
import subprocess
import tempfile
from warnings import warn
Expand Down Expand Up @@ -488,7 +489,7 @@ def _latex_circuit_drawer(
image = utils._trim(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,7 @@
---
fixes:
- |
Fixed an ``OSError`` in the LaTeX circuit drawer on systems whose temporary
directories (*e.g* ``/tmp``) are on a different filesystem to the working
directory. See `#8542 <https://github.com/Qiskit/qiskit-terra/issues/8542>`__
for more detail.

0 comments on commit d163e89

Please sign in to comment.