Skip to content Skip to sidebar Skip to footer

Why Python Doesn't See The Members Of Quantumcircuit Class Qiskit

I`m trying to learn the programming on quantum computers. I have installed qiskit in VS Code (all qiskit extentions available in VS Code market) , python compilator (from Vs Code m

Solution 1:

The errors in question are coming from pylint, a linter, not from python itself. While pylint is pretty clever, some constructs (particularly those involving dynamically-added properties) are beyond its ability to understand. When you encounter situations like this, the best course of action is twofold:

  1. Check the docs, code, etc. to make absolutely sure the code that you've written is right (i.e. verify that the linter result is a false positive)
  2. Tell the linter that you know what you're doing and it should ignore the false positive

user2357112 took care of the first step in the comments above, demonstrating that the property gets dynamically set by another part of the library.

The second step can be accomplished for pylint by adding a comment after each of the offending lines telling it to turn of that particular check for that particular line:

qc.h(q[0])  # pylint: disable=no-member

Post a Comment for "Why Python Doesn't See The Members Of Quantumcircuit Class Qiskit"