dcantrell / pyparted

Python bindings for GNU parted (libparted)
GNU General Public License v2.0
85 stars 42 forks source link

ImportError: No module named abc while running on Python2 #67

Closed 0xFF1E071F closed 4 years ago

0xFF1E071F commented 4 years ago

Hello, Can we use pyparted on Python2 any more? It works on python3 but not on python2. After installing with python2 and then importing i got the error below:

python -c "import parted"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/parted/__init__.py", line 60, in <module>
    from parted.disk import Disk
  File "/usr/lib/python2.7/site-packages/parted/disk.py", line 28, in <module>
    from parted.cachedlist import CachedList
  File "/usr/lib/python2.7/site-packages/parted/cachedlist.py", line 24, in <module>
    from collections.abc import Sequence
ImportError: No module named abc
dcantrell commented 4 years ago

The error you're hitting is due to this commit:

https://github.com/dcantrell/pyparted/commit/e118f7913581b5b1fdd88dda73cd77b41e93ffad

And that was added to address a problem in Fedora which has been hell bent on pretending Python 2 never happened. That said, I am not going to do anything to explicitly prevent using pyparted in Python 2. But I can't co-maintain under Python 2 and 3 (I have limited time myself). My life now is in Python 3, but if you want to send patches that fix it for Python 2 while still preserving Python 3 execution I will absolutely merge them if they work and tests continue to pass.

dcantrell commented 4 years ago

I added the above commit and it works on Python 2 and 3. If you run in to other Python 2 usage problems, I am willing to merge patches that properly guard statements so the work on Python 2 and 3.

0xFF1E071F commented 4 years ago

Thank you it is working now =)