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

ImportError: cannot import name ABC #86

Open
AbelDawson opened this issue Jan 27, 2020 · 9 comments
Open

ImportError: cannot import name ABC #86

AbelDawson opened this issue Jan 27, 2020 · 9 comments

Comments

@AbelDawson
Copy link

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

@stav121
Copy link
Owner

stav121 commented Jan 27, 2020

Hello sir, what version of Python are you using?

@AbelDawson
Copy link
Author

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

@jdberlinski
Copy link

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

@cizordj
Copy link
Contributor

cizordj commented Feb 8, 2020

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

@stav121
Copy link
Owner

stav121 commented Feb 8, 2020

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?

@cizordj
Copy link
Contributor

cizordj commented Feb 9, 2020

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.

@stav121
Copy link
Owner

stav121 commented Feb 9, 2020

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.

@cizordj
Copy link
Contributor

cizordj commented Feb 9, 2020

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
Copy link
Contributor

cizordj commented Feb 9, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants