Skip to content

Commit

Permalink
Fix LaTeX drawer on split-filesystem systems (#8629) (#8632)
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 <[email protected]>
(cherry picked from commit d163e89)

Co-authored-by: Joseph McElroy <[email protected]>
  • Loading branch information
mergify[bot] and jmcelroy01 authored Aug 29, 2022
1 parent f1d1374 commit cb16035
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

Expand Down Expand Up @@ -442,7 +443,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 cb16035

Please sign in to comment.