Skip to content

KeyError: 'result' on execution #13

@alexandrupaler

Description

@alexandrupaler

I received the following error

Traceback (most recent call last):
 ..........
  File "_quantumprogram.py", line 634, in execute
    output = self.run(wait, timeout)
  File "_quantumprogram.py", line 539, in run
    self.__quantum_program["circuits"][name]["execution"][backend]["result"] = job_result["qasms"][index]["result"]
KeyError: 'result'

Process finished with exit code 1

After having a look at line 539 and at the job_result object returned by the IBMQuantumExperience I noticed that there is no key called "result". The returned info from the execution is in the field "data"(?) I used the online device "ibmqx_qasm_simulator".

The following edits helped. Are these edits ok?

In _quantumprogram.py method get_counts()
return self.__quantum_program["circuits"][name]['execution'][device]['data']['counts']

In _quantumprogram.py method run() @ line 539
self.__quantum_program["circuits"][name]["execution"][backend]["data"] = job_result["qasms"][index]["data"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions