i have a simple Python code to generate a Dll Using CFFI :
import cffi
ffibuilder = cffi.FFI()
ffibuilder.embedding_api("""
int Predict();
""")
ffibuilder.set_source("landmark_Library", "")
ffibuilder.embedding_init_code("""
from landmark_Library import ffi
import argparse
from parse_config import ConfigParser
import deepmvlm
from utils3d import Utils3D
@ffi.def_extern()
def Predict():
return 2
""")
ffibuilder.compile(target="landmark_Library.*", verbose=True)
i got this error when calling the dll function : if i add the directory with sys.path.insert(0, "."), it will only work only in my computer , if i change computer the dll will stop working and i get this error.
The error should be self-descriptive: you are doing
from parse_config import ...
but there is no moduleparse_config
found.If you know where the module really is (e.g. in some
parse_config.py
file orparse_config\\__init__.py
file), then make sure that location is insys.path
. The current value ofsys.path
is printed as part of the error message. You can check if it is indeed missing, and if so, you can add it. In particular, it seems that the current directory.
is not insys.path
in your case, so maybe you need to add that (writesys.path.insert(0, ".")
on a line beforefrom parse_config import ...
). Replace"."
with the real path if it is somewhere else.