Handle `AttributeError` in `create_from` under `device_specification.py`
See original GitHub issueInformation
- Qiskit 0.10:
- 3.7:
- Ubuntu 16.04:
What is the current behavior?
As some backends like ibmq_16_melbourne, qasm_simulator and … dont have a default setting, I am getting this:
AttributeError: ‘NoneType’ object has no attribute ‘buffer’
Steps to reproduce the problem
IBMQ.load_accounts() backend_name = ‘ibmq_16_melbourne’ backend = IBMQ.get_backend(backend_name) device = pulse.DeviceSpecification.create_from(backend) - > throws
What is the expected behavior?
to handle the AttributeError case in case backend has no backend.defaults()
Suggested solutions
in qiskit/pulse/channels/device_specification.py:
try except clause has to either be expanded to cover AttributeError in the outer try clause or some other idea…
try:
backend_default = backend.defaults()
buffer = backend_default.buffer
except ModelValidationError:
try:
buffer = backend_config.defaults.get(‘buffer’, 0)
except AttributeError:
buffer = 0
except AttributeError: - I added this
buffer = 0
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)

Top Related StackOverflow Question
Great. I suppose I should join the qiskit organization.
Closing as #2586 has been merged.