Skip to content

OSError when using filename only in circuit_drawer under Windows #477

@alfrisch

Description

@alfrisch

Expected Behavior

circuit_drawer() working on Windows machine

Current Behavior

I tested the function tools/visualization/circuit_drawer under Windows and got an OSError at the conversion step from pdf to png using the poppler tool pdftocairo. Apparently pdftocairo was working properly, but what threw the error was Image.open and os.remove using just the filenames instead of a full path.

Possible Solution

I could fix this by using the full paths to the .png images, i.e.

Image.open("{}".format(os.path.join(tmpdirname, filename + '.png')))
os.remove("{}".format(os.path.join(tmpdirname, filename + '.png')))

Steps to Reproduce (for bugs)

execute circuit_drawer() on Windows machine

Your Environment

  • Version used: QISKit 0.5.1 installed from pip
  • Operating System and version: Windows 10, cygwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions