-
-
Notifications
You must be signed in to change notification settings - Fork 70
AttributeError: 'PosixPath' object has no attribute 'is_relative_to' #52
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
Comments
Hi @FabioMD1972, I will make sure to fix this issue in the next difPy update. Again, thanks for opening the issue! |
I do believe this happens in linux environments, as I'm getting this same error on my docker container:
But not on my macos machine. Edit: On my macos
on the debian docker container:
|
Ah shoot turns out its related to the python version. I'll open a PR with a python 3.8 compatible alternative for those who cannot update the python version |
Hi all, Thanks a lot for reporting the issue and thanks @guites for the solution suggestion! This issue is now fixed with difPy v3.0.0. All the best, |
Hi,
on Google Colab I got this error:
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
----> 1 src_res= dif("/content/02_Draw_append", "/content/02_Draw")
1 frames
/usr/local/lib/python3.8/dist-packages/difPy/dif.py in init(self, directory_A, directory_B, recursive, similarity, px_size, show_progress, show_output, delete, silent_del)
70 directory_A = dif._process_directory(directory_A)
71 directory_B = dif._process_directory(directory_B)
---> 72 dif._path_validation([directory_A, directory_B])
73 img_matrices_A, folderfiles_A = dif._create_imgs_matrix(directory_A, px_size, recursive, show_progress)
74 img_matrices_B, folderfiles_B = dif._create_imgs_matrix(directory_B, px_size, recursive, show_progress)
/usr/local/lib/python3.8/dist-packages/difPy/dif.py in _path_validation(paths)
143 raise ValueError('An attempt to compare the directory with itself.')
144 path1, path2 = paths
--> 145 if path1.is_relative_to(path2) or path2.is_relative_to(path1):
146 raise ValueError('One directory belongs to another.')
147
AttributeError: 'PosixPath' object has no attribute 'is_relative_to'`
the dif call is for two different folders:
src_res= dif("/content/02_Draw_append", "/content/02_Draw")
All works fine if I call it on the some folder like:
src_res= dif("/content/02_Draw_append")
Here you can find pip instal info:
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Requirement already satisfied: difPy in /usr/local/lib/python3.8/dist-packages (2.4.5) Requirement already satisfied: opencv-python in /usr/local/lib/python3.8/dist-packages (from difPy) (4.6.0.66) Requirement already satisfied: matplotlib in /usr/local/lib/python3.8/dist-packages (from difPy) (3.2.2) Requirement already satisfied: scikit-image in /usr/local/lib/python3.8/dist-packages (from difPy) (0.18.3) Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from difPy) (1.21.6) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib->difPy) (1.4.4) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib->difPy) (2.8.2) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib->difPy) (3.0.9) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.8/dist-packages (from matplotlib->difPy) (0.11.0) Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in /usr/local/lib/python3.8/dist-packages (from scikit-image->difPy) (7.1.2) Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.8/dist-packages (from scikit-image->difPy) (2022.10.10) Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.8/dist-packages (from scikit-image->difPy) (2.9.0) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.8/dist-packages (from scikit-image->difPy) (2.8.8) Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.8/dist-packages (from scikit-image->difPy) (1.4.1) Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from scikit-image->difPy) (1.7.3) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/dist-packages (from python-dateutil>=2.1->matplotlib->difPy) (1.15.0)
Tks.
The text was updated successfully, but these errors were encountered: