# Buggy code
def load_class(self, conanfile_path):
    try:
        return self.cached_conanfiles[conanfile_path]
    except KeyError:
        self._python_requires.valid = True
        _, conanfile = parse_conanfile(conanfile_path, self._python_requires)
        self._python_requires.valid = False
        self.cached_conanfiles[conanfile_path] = conanfile
    return conanfile


# 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 load_class(self, conanfile_path):
    conanfile = self.cached_conanfiles.get(conanfile_path)
    if conanfile:
        return conanfile

    try:
        self._python_requires.valid = True
        _, conanfile = parse_conanfile(conanfile_path, self._python_requires)
        self._python_requires.valid = False
        self.cached_conanfiles[conanfile_path] = conanfile
        return conanfile
    except ConanException as e:
        raise ConanException(
            "Error loading conanfile at '{}': {}".format(conanfile_path, e)
        )