prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [bug] Linter "Unable to import" warning when importing a shared Python Conan package in the build() step
  - [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
  - [x] I've specified the Conan version, operating system version and any tool that can be relevant.
  - [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
  
  ---
  
  I followed the instructions on http://docs.conan.io/en/latest/howtos/python_code_reuse.html.  When I get to the "Requiring a python conan package" step, the linter gives me a warning about importing the shared package:
  
      $ git clone https://github.com/smokris/conan-test-library
      $ cd conan-test-library
      $ conan export . me/testing
      $ cd ..
  
      $ git clone https://github.com/smokris/conan-test-consumer
      $ cd conan-test-consumer
      $ conan create . me/testing
      HelloPyReuse/1.0@me/testing: Exporting package recipe
      Linter warnings
          WARN: Linter. Line 9: Unable to import 'hello'
      …
      HelloPyReuse/1.0@me/testing: Calling build()
      Hello World from Python!
      …
  
  
  (The imported package works fine; the problem is just that the linter is emitting a warning.  I'd prefer that the linter not show this false-positive warning, to improve the linter's signal-to-noise ratio.)
  
  I'm able to reproduce this using:
  
  - Conan 1.1.1 on my local macOS 10.13.3 system
  - Conan 1.1.1 on Travis CI's Mac OS 10.10.5 image
  - Conan 1.1.1 on Travis CI's Ubuntu 14.04.5 image
  - Conan 1.2.0 on CentOS 7.4
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `conans/client/cmd/export_linter.py`
  Content:
  ```
  1 import json
  2 import os
  3 import sys
  4 
  5 import platform
  6 
  7 from conans.client.output import Color
  8 from conans.errors import ConanException
  9 from subprocess import PIPE, Popen
  10 from conans import __path__ as root_path
  11 
  12 
  13 def conan_linter(conanfile_path, out):
  14     if getattr(sys, 'frozen', False):
  15         out.info("No linter available. Use a pip installed conan for recipe linting")
  16         return
  17     apply_lint = os.environ.get("CONAN_RECIPE_LINTER", True)
  18     if not apply_lint or apply_lint == "False":
  19         return
  20 
  21     dir_path = os.path.dirname(root_path[0]).replace("\\", "/")
  22     dirname = os.path.dirname(conanfile_path).replace("\\", "/")
  23     hook = '--init-hook="import sys;sys.path.extend([\'%s\', \'%s\'])"' % (dirname, dir_path)
  24 
  25     try:
  26         py3_msgs = None
  27         msgs, py3_msgs = _normal_linter(conanfile_path, hook)
  28     except Exception as e:
  29         out.warn("Failed pylint: %s" % e)
  30     else:
  31         if py3_msgs:
  32             out.writeln("Python 3 incompatibilities\n    ERROR: %s"
  33                         % "\n    ERROR: ".join(py3_msgs),
  34                         front=Color.BRIGHT_MAGENTA)
  35         if msgs:
  36             out.writeln("Linter warnings\n    WARN: %s" % "\n    WARN: ".join(msgs),
  37                         front=Color.MAGENTA)
  38         pylint_werr = os.environ.get("CONAN_PYLINT_WERR", None)
  39         if pylint_werr and (py3_msgs or msgs):
  40             raise ConanException("Package recipe has linter errors. Please fix them.")
  41 
  42 
  43 def _runner(args):
  44     command = ["pylint",  "--output-format=json"] + args
  45     command = " ".join(command)
  46     shell = True if platform.system() != "Windows" else False
  47     proc = Popen(command, shell=shell, bufsize=10, stdout=PIPE, stderr=PIPE)
  48     stdout, _ = proc.communicate()
  49     return json.loads(stdout.decode("utf-8")) if stdout else {}
  50 
  51 
  52 def _normal_linter(conanfile_path, hook):
  53     args = ['--py3k', "--enable=all", "--reports=no", "--disable=no-absolute-import", "--persistent=no",
  54             hook, '"%s"' % conanfile_path]
  55     pylintrc = os.environ.get("CONAN_PYLINTRC", None)
  56     if pylintrc:
  57         if not os.path.exists(pylintrc):
  58             raise ConanException("File %s defined by PYLINTRC doesn't exist" % pylintrc)
  59         args.append('--rcfile="%s"' % pylintrc)
  60 
  61     output_json = _runner(args)
  62     dynamic_fields = ("source_folder", "build_folder", "package_folder", "info_build",
  63                       "build_requires", "info")
  64 
  65     def _accept_message(msg):
  66         symbol = msg.get("symbol")
  67         text = msg.get("message")
  68 
  69         if symbol == "no-member":
  70             for field in dynamic_fields:
  71                 if field in text:
  72                     return False
  73         if symbol == "not-callable" and "self.copy is not callable" == text:
  74             return False
  75         if symbol == "not-callable" and "self.copy_deps is not callable" == text:
  76             return False
  77         if symbol in ("bare-except", "broad-except"):  # No exception type(s) specified
  78             return False
  79 
  80         return True
  81 
  82     result = []
  83     py3msgs = []
  84     for msg in output_json:
  85         if msg.get("type") in ("warning", "error"):
  86             message_id = msg.get("symbol")
  87             if message_id in ("print-statement", "dict-iter-method"):
  88                 py3msgs.append("Py3 incompatibility. Line %s: %s"
  89                                % (msg.get("line"), msg.get("message")))
  90             elif _accept_message(msg):
  91                 result.append("Linter. Line %s: %s" % (msg.get("line"), msg.get("message")))
  92 
  93     return result, py3msgs
  94
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/conans/client/cmd/export_linter.py b/conans/client/cmd/export_linter.py
  --- a/conans/client/cmd/export_linter.py
  +++ b/conans/client/cmd/export_linter.py
  @@ -76,6 +76,8 @@
               return False
           if symbol in ("bare-except", "broad-except"):  # No exception type(s) specified
               return False
  +        if symbol == "import-error" and msg.get("column") > 3:  # Import of a conan python package
  +            return False
   
           return True
  
verification_info: {"golden_diff": "diff --git a/conans/client/cmd/export_linter.py b/conans/client/cmd/export_linter.py\n--- a/conans/client/cmd/export_linter.py\n+++ b/conans/client/cmd/export_linter.py\n@@ -76,6 +76,8 @@\n             return False\n         if symbol in (\"bare-except\", \"broad-except\"):  # No exception type(s) specified\n             return False\n+        if symbol == \"import-error\" and msg.get(\"column\") > 3:  # Import of a conan python package\n+            return False\n \n         return True\n", "issue": "[bug] Linter \"Unable to import\" warning when importing a shared Python Conan package in the build() step\n- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).\r\n- [x] I've specified the Conan version, operating system version and any tool that can be relevant.\r\n- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.\r\n\r\n---\r\n\r\nI followed the instructions on http://docs.conan.io/en/latest/howtos/python_code_reuse.html.  When I get to the \"Requiring a python conan package\" step, the linter gives me a warning about importing the shared package:\r\n\r\n    $ git clone https://github.com/smokris/conan-test-library\r\n    $ cd conan-test-library\r\n    $ conan export . me/testing\r\n    $ cd ..\r\n\r\n    $ git clone https://github.com/smokris/conan-test-consumer\r\n    $ cd conan-test-consumer\r\n    $ conan create . me/testing\r\n    HelloPyReuse/1.0@me/testing: Exporting package recipe\r\n    Linter warnings\r\n        WARN: Linter. Line 9: Unable to import 'hello'\r\n    \u2026\r\n    HelloPyReuse/1.0@me/testing: Calling build()\r\n    Hello World from Python!\r\n    \u2026\r\n\r\n\r\n(The imported package works fine; the problem is just that the linter is emitting a warning.  I'd prefer that the linter not show this false-positive warning, to improve the linter's signal-to-noise ratio.)\r\n\r\nI'm able to reproduce this using:\r\n\r\n- Conan 1.1.1 on my local macOS 10.13.3 system\r\n- Conan 1.1.1 on Travis CI's Mac OS 10.10.5 image\r\n- Conan 1.1.1 on Travis CI's Ubuntu 14.04.5 image\r\n- Conan 1.2.0 on CentOS 7.4\r\n\n", "before_files": [{"content": "import json\nimport os\nimport sys\n\nimport platform\n\nfrom conans.client.output import Color\nfrom conans.errors import ConanException\nfrom subprocess import PIPE, Popen\nfrom conans import __path__ as root_path\n\n\ndef conan_linter(conanfile_path, out):\n    if getattr(sys, 'frozen', False):\n        out.info(\"No linter available. Use a pip installed conan for recipe linting\")\n        return\n    apply_lint = os.environ.get(\"CONAN_RECIPE_LINTER\", True)\n    if not apply_lint or apply_lint == \"False\":\n        return\n\n    dir_path = os.path.dirname(root_path[0]).replace(\"\\\\\", \"/\")\n    dirname = os.path.dirname(conanfile_path).replace(\"\\\\\", \"/\")\n    hook = '--init-hook=\"import sys;sys.path.extend([\\'%s\\', \\'%s\\'])\"' % (dirname, dir_path)\n\n    try:\n        py3_msgs = None\n        msgs, py3_msgs = _normal_linter(conanfile_path, hook)\n    except Exception as e:\n        out.warn(\"Failed pylint: %s\" % e)\n    else:\n        if py3_msgs:\n            out.writeln(\"Python 3 incompatibilities\\n    ERROR: %s\"\n                        % \"\\n    ERROR: \".join(py3_msgs),\n                        front=Color.BRIGHT_MAGENTA)\n        if msgs:\n            out.writeln(\"Linter warnings\\n    WARN: %s\" % \"\\n    WARN: \".join(msgs),\n                        front=Color.MAGENTA)\n        pylint_werr = os.environ.get(\"CONAN_PYLINT_WERR\", None)\n        if pylint_werr and (py3_msgs or msgs):\n            raise ConanException(\"Package recipe has linter errors. Please fix them.\")\n\n\ndef _runner(args):\n    command = [\"pylint\",  \"--output-format=json\"] + args\n    command = \" \".join(command)\n    shell = True if platform.system() != \"Windows\" else False\n    proc = Popen(command, shell=shell, bufsize=10, stdout=PIPE, stderr=PIPE)\n    stdout, _ = proc.communicate()\n    return json.loads(stdout.decode(\"utf-8\")) if stdout else {}\n\n\ndef _normal_linter(conanfile_path, hook):\n    args = ['--py3k', \"--enable=all\", \"--reports=no\", \"--disable=no-absolute-import\", \"--persistent=no\",\n            hook, '\"%s\"' % conanfile_path]\n    pylintrc = os.environ.get(\"CONAN_PYLINTRC\", None)\n    if pylintrc:\n        if not os.path.exists(pylintrc):\n            raise ConanException(\"File %s defined by PYLINTRC doesn't exist\" % pylintrc)\n        args.append('--rcfile=\"%s\"' % pylintrc)\n\n    output_json = _runner(args)\n    dynamic_fields = (\"source_folder\", \"build_folder\", \"package_folder\", \"info_build\",\n                      \"build_requires\", \"info\")\n\n    def _accept_message(msg):\n        symbol = msg.get(\"symbol\")\n        text = msg.get(\"message\")\n\n        if symbol == \"no-member\":\n            for field in dynamic_fields:\n                if field in text:\n                    return False\n        if symbol == \"not-callable\" and \"self.copy is not callable\" == text:\n            return False\n        if symbol == \"not-callable\" and \"self.copy_deps is not callable\" == text:\n            return False\n        if symbol in (\"bare-except\", \"broad-except\"):  # No exception type(s) specified\n            return False\n\n        return True\n\n    result = []\n    py3msgs = []\n    for msg in output_json:\n        if msg.get(\"type\") in (\"warning\", \"error\"):\n            message_id = msg.get(\"symbol\")\n            if message_id in (\"print-statement\", \"dict-iter-method\"):\n                py3msgs.append(\"Py3 incompatibility. Line %s: %s\"\n                               % (msg.get(\"line\"), msg.get(\"message\")))\n            elif _accept_message(msg):\n                result.append(\"Linter. Line %s: %s\" % (msg.get(\"line\"), msg.get(\"message\")))\n\n    return result, py3msgs\n", "path": "conans/client/cmd/export_linter.py"}], "after_files": [{"content": "import json\nimport os\nimport sys\n\nimport platform\n\nfrom conans.client.output import Color\nfrom conans.errors import ConanException\nfrom subprocess import PIPE, Popen\nfrom conans import __path__ as root_path\n\n\ndef conan_linter(conanfile_path, out):\n    if getattr(sys, 'frozen', False):\n        out.info(\"No linter available. Use a pip installed conan for recipe linting\")\n        return\n    apply_lint = os.environ.get(\"CONAN_RECIPE_LINTER\", True)\n    if not apply_lint or apply_lint == \"False\":\n        return\n\n    dir_path = os.path.dirname(root_path[0]).replace(\"\\\\\", \"/\")\n    dirname = os.path.dirname(conanfile_path).replace(\"\\\\\", \"/\")\n    hook = '--init-hook=\"import sys;sys.path.extend([\\'%s\\', \\'%s\\'])\"' % (dirname, dir_path)\n\n    try:\n        py3_msgs = None\n        msgs, py3_msgs = _normal_linter(conanfile_path, hook)\n    except Exception as e:\n        out.warn(\"Failed pylint: %s\" % e)\n    else:\n        if py3_msgs:\n            out.writeln(\"Python 3 incompatibilities\\n    ERROR: %s\"\n                        % \"\\n    ERROR: \".join(py3_msgs),\n                        front=Color.BRIGHT_MAGENTA)\n        if msgs:\n            out.writeln(\"Linter warnings\\n    WARN: %s\" % \"\\n    WARN: \".join(msgs),\n                        front=Color.MAGENTA)\n        pylint_werr = os.environ.get(\"CONAN_PYLINT_WERR\", None)\n        if pylint_werr and (py3_msgs or msgs):\n            raise ConanException(\"Package recipe has linter errors. Please fix them.\")\n\n\ndef _runner(args):\n    command = [\"pylint\",  \"--output-format=json\"] + args\n    command = \" \".join(command)\n    shell = True if platform.system() != \"Windows\" else False\n    proc = Popen(command, shell=shell, bufsize=10, stdout=PIPE, stderr=PIPE)\n    stdout, _ = proc.communicate()\n    return json.loads(stdout.decode(\"utf-8\")) if stdout else {}\n\n\ndef _normal_linter(conanfile_path, hook):\n    args = ['--py3k', \"--enable=all\", \"--reports=no\", \"--disable=no-absolute-import\", \"--persistent=no\",\n            hook, '\"%s\"' % conanfile_path]\n    pylintrc = os.environ.get(\"CONAN_PYLINTRC\", None)\n    if pylintrc:\n        if not os.path.exists(pylintrc):\n            raise ConanException(\"File %s defined by PYLINTRC doesn't exist\" % pylintrc)\n        args.append('--rcfile=\"%s\"' % pylintrc)\n\n    output_json = _runner(args)\n    dynamic_fields = (\"source_folder\", \"build_folder\", \"package_folder\", \"info_build\",\n                      \"build_requires\", \"info\")\n\n    def _accept_message(msg):\n        symbol = msg.get(\"symbol\")\n        text = msg.get(\"message\")\n\n        if symbol == \"no-member\":\n            for field in dynamic_fields:\n                if field in text:\n                    return False\n        if symbol == \"not-callable\" and \"self.copy is not callable\" == text:\n            return False\n        if symbol == \"not-callable\" and \"self.copy_deps is not callable\" == text:\n            return False\n        if symbol in (\"bare-except\", \"broad-except\"):  # No exception type(s) specified\n            return False\n        if symbol == \"import-error\" and msg.get(\"column\") > 3:  # Import of a conan python package\n            return False\n\n        return True\n\n    result = []\n    py3msgs = []\n    for msg in output_json:\n        if msg.get(\"type\") in (\"warning\", \"error\"):\n            message_id = msg.get(\"symbol\")\n            if message_id in (\"print-statement\", \"dict-iter-method\"):\n                py3msgs.append(\"Py3 incompatibility. Line %s: %s\"\n                               % (msg.get(\"line\"), msg.get(\"message\")))\n            elif _accept_message(msg):\n                result.append(\"Linter. Line %s: %s\" % (msg.get(\"line\"), msg.get(\"message\")))\n\n    return result, py3msgs\n", "path": "conans/client/cmd/export_linter.py"}]}