πŸ› Possible Bug: CVBpy manually injects site-packages into path

Hi,
These lines exist in __init__.py of cbv. What are they doing?

# try to add the cvb module path to the PYTHONPATH
try:
    site_packages = next(p for p in _sys.path if 'site-packages' in p)
    importpath = _os.path.join(site_packages,"cvb")
    _sys.path.append(importpath)
except:
    print('failed to add cvb module path to sys.path. Is site-packages missing?')

When using the PDM package manager, the site-packages structure is not there. This means the we get an ugly print statement onto the command line. The same is probably true when building into an exe, or other such things.

Perhaps consider using the logging module so we can control it without patching CVBpy and wrapping your exceptions so to avoid us digging through all the modules trying to find a print statement or exception, since we have no way of knowing that it is coming from this module.

What are your thoughts?

Hi @John ,
thank you for your question. I hope you understand, that we - at the moment - ship CVBpy with the requirement of pip (and only pip) as package manager, and pip forces site-packages to be there. These lines help us link to the CVBpy dlls. Furthermore, pdm is comparably new, and the current release isn’t tested with this package manager. We understand the problem you’re facing, we will think about a solution for future releases. Until then, we hope that you get along with your workaround. If you face problems, please return to us.