i3wm-themer icon indicating copy to clipboard operation
i3wm-themer copied to clipboard

ImportError: cannot import name ABC

Open AbelDawson opened this issue 5 years ago • 9 comments

Ubuntu 19.10

Traceback (most recent call last): File "i3wm-themer.py", line 12, in from i3wmthemer.models.theme import Theme File "/home/abel/i3wm-themer/i3wmthemer/models/theme.py", line 1, in from i3wmthemer.models.abstract_theme import AbstractTheme File "/home/abel/i3wm-themer/i3wmthemer/models/abstract_theme.py", line 1, in from abc import ABC, abstractmethod ImportError: cannot import name ABC

AbelDawson avatar Jan 27 '20 13:01 AbelDawson

Hello sir, what version of Python are you using?

stav121 avatar Jan 27 '20 18:01 stav121

It should be python 3. I just ran the Ubuntu.sh

AbelDawson avatar Jan 27 '20 19:01 AbelDawson

Try replacing all of the python python commands in the readme to python3:

python3 i3wm-themer.py --config config.yaml --backup /home/[USER]/Backups
python3 i3wm-themer.py --config config.yaml --install defaults/
python3 i3wm-themer.py --config config.yaml --load themes/[theme_id].json

jdberlinski avatar Feb 03 '20 02:02 jdberlinski

I'm having this problem too, but mine is a bit different. Everything compiles perfectly but in the end I get a message like this:

Traceback (most recent call last):
  File "i3wm-themer.py", line 12, in <module>
    from i3wmthemer.models.theme import Theme
  File "/home/cezar/Downloads/i3wm-themer/i3wmthemer/models/theme.py", line 1, in <module>
    from i3wmthemer.models.abstract_theme import AbstractTheme
  File "/home/cezar/Downloads/i3wm-themer/i3wmthemer/models/abstract_theme.py", line 1, in <module>
    from abc import ABC, abstractmethod
ImportError: cannot import name ABC
Traceback (most recent call last):
  File "i3wm-themer.py", line 12, in <module>
    from i3wmthemer.models.theme import Theme
  File "/home/cezar/Downloads/i3wm-themer/i3wmthemer/models/theme.py", line 1, in <module>
    from i3wmthemer.models.abstract_theme import AbstractTheme
  File "/home/cezar/Downloads/i3wm-themer/i3wmthemer/models/abstract_theme.py", line 1, in <module>
    from abc import ABC, abstractmethod
ImportError: cannot import name ABC

Read the README.md

Afterwards, when I run: $ ./change.sh 004

Traceback (most recent call last): File "i3wm-themer.py", line 11, in <module> from i3wmthemer.models.configuration import ConfigurationLoader File "/home/cezar/Downloads/i3wm-themer/i3wmthemer/models/configuration.py", line 4, in <module> import yaml ModuleNotFoundError: No module named 'yaml'

I'm running under a fresh installation of Debian testing with only Xorg and lightdm.

$ python --version Python 2.7.17 $ python3 --version Python 3.7.6

Content of change.sh

### Script written by James Shane ( github.com/jamesshane )

python3 i3wm-themer.py --config config.yaml --load themes/"$1".json

cizordj avatar Feb 08 '20 01:02 cizordj

I think the first issue might need more investigation, once I cannot reproduce it locally. About the second one, if you run :

pip3 install -r requirements.txt

in the parent folder of the repo, doesn't it install the proper version of the yaml library?

stav121 avatar Feb 08 '20 10:02 stav121

Yes it worked! Thanks. Yaml is now installed and I can change the themes properly. Now polybar isn't working but it's another matter.

cizordj avatar Feb 09 '20 14:02 cizordj

In order to make Polybar work properly you probably have to go through Polybar's wiki, maybe some of the functions are not configured properly for your case? You could try to launch it from the script directly and check the output, will probably lead you to the source of the errors.

stav121 avatar Feb 09 '20 15:02 stav121

Polybar is 100% working now, there were some problems in the config files, i just ran this command again python i3wm-themer.py --config config.yaml --install defaults/ Now thank you so much. The only mistake I did right from beginning was not to use pip3 instead of pip when I had to install the "requirements" and during the compilation in the "install_debian.sh" script there is a package missing, I can't remeber right now which was, but when I do I will make a PR adding this package name to the list. Without this package the compilation couldn't start.

cizordj avatar Feb 09 '20 17:02 cizordj

I remeber one of them, x11-xserver-utils without this package the ~/.Xresources cannot be loaded and compton is missing as well.

cizordj avatar Feb 09 '20 17:02 cizordj