# Buggy code
def __call__(self, require):
    if not self.valid:
        raise ConanException("Invalid use of python_requires(%s)" % require)
    python_req = self._look_for_require(require)
    self._requires.append(python_req)
    return python_req.module


# Traceback (ValueError)
conan inspect . -a options
zlib/1.2.8@conan/stable: Not found in local cache, looking in remotes...
zlib/1.2.8@conan/stable: Trying with 'kk'...
zlib/1.2.8@conan/stable: Trying with 'rr'...
zlib/1.2.8@conan/stable: Trying with 'bincrafters'...
zlib/1.2.8@conan/stable: Trying with 'arti'...
zlib/1.2.8@conan/stable: Trying with 'virtual'...
zlib/1.2.8@conan/stable: Trying with 'c3i_PR-1_9fe37beb14d6c6ecfcec3127ea197805dcdda695'...
zlib/1.2.8@conan/stable: Trying with 'c3i_PR-1_20437a99db62349f366d19e8a571b7f1c5c1eafa'...
zlib/1.2.8@conan/stable: Trying with 'c3i_PR-1_a9da64e0861fb0a7fc7f2448a47f7ce97fda8a73'...
ERROR: Unable to load conanfile in /tmp/kk/conanfile.py
ValueError: not enough values to unpack (expected 7, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/luism/workspace/conan_sources/conans/client/conan_api.py", line 285, in inspect
ref = ConanFileReference.loads(path)
File "/home/luism/workspace/conan_sources/conans/model/ref.py", line 114, in loads
"OpenCV/1.0.6@user/stable" % text)
conans.errors.ConanException: Wrong package recipe reference .
Write something like OpenCV/1.0.6@user/stable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/luism/workspace/conan_sources/conans/client/loader.py", line 45, in load_class
return self.cached_conanfiles[conanfile_path]
KeyError: '/tmp/kk/conanfile.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/luism/workspace/conan_sources/conans/client/graph/python_requires.py", line 33, in _look_for_require
python_require = self._cached_requires[require]
KeyError: 'zlib/1.2.8@conan/stable'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/luism/workspace/conan_sources/conans/client/loader.py", line 254, in _parse_conanfile
loaded = imp.load_source(module_id, conan_file_path)
File "/home/luism/.virtualenvs/conan_use/lib/python3.6/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/kk/conanfile.py", line 3, in <module>
kk = python_requires("zlib/1.2.8@conan/stable")
File "/home/luism/workspace/conan_sources/conans/client/graph/python_requires.py", line 58, in __call__
python_req = self._look_for_require(require)
File "/home/luism/workspace/conan_sources/conans/client/graph/python_requires.py", line 41, in _look_for_require
recorder=ActionRecorder())
File "/home/luism/workspace/conan_sources/conans/client/graph/proxy.py", line 33, in get_recipe
result = self._get_recipe(ref, check_updates, update, remote_name, recorder)
File "/home/luism/workspace/conan_sources/conans/client/graph/proxy.py", line 49, in _get_recipe
remote, new_ref = self._download_recipe(ref, output, remote_name, recorder)
File "/home/luism/workspace/conan_sources/conans/client/graph/proxy.py", line 155, in _download_recipe
raise NotFoundException(msg)
conans.errors.NotFoundException: Unable to find 'zlib/1.2.8@conan/stable' in remotes

# Fixed code
def __call__(self, require):
    if not self.valid:
        raise ConanException("Invalid use of python_requires(%s)" % require)
    try:
        python_req = self._look_for_require(require)
        self._requires.append(python_req)
        return python_req.module
    except NotFoundException:
        raise ConanException(
            'Unable to find python_requires("{}") in remotes'.format(require)
        )