Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgutil.iter_modules() error: 'PosixPath' object has no attribute 'startswith' #107

Open
mtreviso opened this issue Aug 21, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@mtreviso
Copy link

Describe the bug
pkgutil.iter_modules breaks if a Path is passed instead of a str on some versions of python. This is due to a regression in Python. See the original issue report here: https://bugs.python.org/issue44061

To Reproduce
Try:

from pathlib import Path
from pkgutil import iter_modules
package_dir = Path('.')
iter_modules([package_dir])

>> AttributeError: 'PosixPath' object has no attribute 'startswith'

Environment (please complete the following information):

  • OS: Ubuntu 20.04.2 LTS
  • OpenKiwi version: 2.1.0
  • Python version: 3.8.10

Additional context
A simple fix is to convert Path to str:

iter_modules([str(package_dir)])

File where the error occurs: kiwi/systems/__init__.py

@mtreviso mtreviso added the bug Something isn't working label Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant