Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52247

Re: Resolving import errors reported by PyLint in modules using Python.NET

References <2401ddc7-0fe0-4cd9-b7cf-f2dd8649c58f@googlegroups.com>
From Benjamin Kaplan <benjamin.kaplan@case.edu>
Date 2013-08-08 22:47 -0700
Subject Re: Resolving import errors reported by PyLint in modules using Python.NET
Newsgroups comp.lang.python
Message-ID <mailman.386.1376027668.1251.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Aug 8, 2013 at 10:17 PM,  <adam.preble@gmail.com> wrote:
> PyLint can't figure out imports of .NET code being referenced in my Python scripts that use Python.NET.  I can kind of see why; you have to evaluate some clr.AddReference calls for the imports to even succeed.  I wonder if I have any recourse.  Generally, to import a DLL you have to do a few things.  I guess for an example I'll import a .NET string:
>
> ----
> import clr    # Python .NET common-language runtime module, the important part of it all
>
> clr.AddReference("System")
> from System import String   # .NET System.String
>
> can = String("Spam")
> ----
>
> PyLint is not amused:
> F:  4, 0: Unable to import 'System' (import-error)
>
> I wondered if there were any tricks to make it work.  I don't want to just ignore import-error, either by explicitly telling pylint to ignore them, or be getting complacent in seeing them all the time.  I am also kind of curious if PyLint will expose new problems if it's able to figure out more things after successfully  passing the imports.  I wouldn't really know.

Are you using Python.NET or IronPython? IronPython is reasonably well
supported, and it looks like there's a patch you can use to get PyLint
working on it (see
http://mail.python.org/pipermail/ironpython-users/2012-June/016099.html
). Not sure what's going on with Python.NET

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Resolving import errors reported by PyLint in modules using Python.NET adam.preble@gmail.com - 2013-08-08 22:17 -0700
  Re: Resolving import errors reported by PyLint in modules using Python.NET Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-08-08 22:47 -0700
    Re: Resolving import errors reported by PyLint in modules using Python.NET adam.preble@gmail.com - 2013-08-11 21:21 -0700

csiph-web