question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle `AttributeError` in `create_from` under `device_specification.py`

See original GitHub issue

Information

  • 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:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
eggerdjcommented, Jun 6, 2019

Great. I suppose I should join the qiskit organization.

0reactions
taalexandercommented, Jul 11, 2019

Closing as #2586 has been merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix AttributeError in Python - Rollbar
The Python AttributeError is an exception that occurs when an attribute reference or assignment fails. Learn how to fix it.
Read more >
How to handle AttributeError in python? - regex - Stack Overflow
match_obj = to_find.search(search_str) if match_obj: #do things with match_obj. Other handling will go in an else block if you need to do ...
Read more >
Python: AttributeError - GeeksforGeeks
Solution for AttributeError. Errors and exceptions in Python can be handled using exception handling i.e. by using try and except in Python.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found