Skip to content

Commit

Permalink
fix issue with filename location on windows (#543)
Browse files Browse the repository at this point in the history
* fix issue with filename location on windows

* autopep8

* Revert autopep8 due to E225
  • Loading branch information
eendebakpt authored and diego-plan9 committed Jun 7, 2018
1 parent 5f84d0e commit 975e551
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qiskit/tools/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,10 @@ def circuit_drawer(circuit,
try:
subprocess.run(["pdftocairo", "-singlefile", "-png", "-q",
"{}".format(os.path.join(tmpdirname, filename + '.pdf'))])
im = Image.open("{0}.png".format(filename))
pngfile = os.path.join(tmpdirname, "{0}.png".format(filename))
im = Image.open(pngfile)
im = trim(im)
os.remove("{0}.png".format(filename))
os.remove(pngfile)
except OSError as e:
if e.errno == os.errno.ENOENT:
logger.warning('WARNING: Unable to convert pdf to image. '
Expand Down

0 comments on commit 975e551

Please sign in to comment.