Friday, 1 November 2019

Python getting IDE linter to see clr within pythonnet

I am using the pythonnet package in MSMQ communications. In my IDE (PyCharm CE), I have the following sample code:

import pythoncom

import clr



clr.AddReference("System")

clr.AddReference("System.Messaging")

from System import TimeSpan

from System.Messaging import MessageQueue


Aside: this code works fine when I actually run it using Python 3.6.

And below is a screenshot of what it looks like inside PyCharm.

What I Am Seeing

  • My interpreter is configured to properly point at my virtual environment
    • As shown by no complaints on line 1 in my image
  • For clr is says: No module named clr
  • For System it says: Unresolved reference 'System'

Other than using noqa comments, how can I get my PyCharm linting to do the following:

  • Properly see clr?
  • Not complain about from System import XYZ?

Versioning Info

  • IDE: PyCharm Community Edition 2019.2
  • pythonnet 2.3.0, installed in a virtual environment


from Python getting IDE linter to see clr within pythonnet

No comments:

Post a Comment