Antergos / web-greeter

A modern, visually appealing greeter for LightDM.
http://antergos.github.io/web-greeter
GNU General Public License v3.0
232 stars 57 forks source link

web-greeter executable trying to run Python 2 file with python3 #167

Closed super-cooper closed 6 years ago

super-cooper commented 6 years ago

When I run the web-greeter command from terminal, I get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/bin/web-greeter/__main__.py", line 43, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
  File "/usr/bin/web-greeter/bridge/__init__.py", line 68, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
  File "/usr/bin/web-greeter/bridge/Greeter.py", line 31, in <module>
  File "/usr/local/lib/python3.6/site-packages/gi/__init__.py", line 39
    print url
            ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(t url)?

This is a classic case of python3 trying to run a Python 2 file. However, my default python command runs Python 2.7, so I'm not sure why it is using Python 3.6. Is there any way I can force it to use Python 2?

super-cooper commented 6 years ago

I'm now noticing that this is an issue with the gi package, which I installed using pip3. I'm not sure how to fix this either.

EDIT: I managed to fix this error by installing gi using apt, but now it says it can't find package _gi which I am currently looking into.

EDIT 2: Not sure how to fix this at all.

EDIT 3: Fixed the problem with gi by manually editing the file. Now it says there's a problem with whither:

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/bin/web-greeter/__main__.py", line 37, in <module>
  File "/usr/local/lib/python3.5/dist-packages/whither/app.py", line 33, in <module>
    from .toolkits.bootstrap import Application, Window, WebContainer
  File "/usr/local/lib/python3.5/dist-packages/whither/toolkits/bootstrap.py", line 31, in <module>
    from .qt.window import QtWindow as Window
  File "/usr/local/lib/python3.5/dist-packages/whither/toolkits/qt/window.py", line 47, in <module>
    from whither.base.objects import Window
  File "/usr/local/lib/python3.5/dist-packages/whither/base/objects.py", line 75, in <module>
    class BaseObject(metaclass=MCS):
  File "/usr/local/lib/python3.5/dist-packages/whither/base/metaclasses.py", line 52, in __new__
    super(self, self).__init_subclass__(**kwargs)
AttributeError: 'super' object has no attribute '__init_subclass__'

I have a feeling I may have made a grave mistake

JordanKnott commented 6 years ago

I've been having this same issue. @super-cooper how were you able to resolve it?

super-cooper commented 6 years ago

@JordanKnott I figured out the problem was that I had reinstalled python3-gi. Ubuntu and Debian (I'm assuming you're on one of those since you're having the same problem) ship with python 3.5 and the gi package installed. Unfortunately, the gi package on pip appears to be broken, and the python3-gi package in apt appears to be broken in other aspects as well. I'm not sure why this is. So what basically ended up happening is that I broke my python install, and my DE (Cinnamon) because it, as well as many other graphical python applications, rely on gi. My solution to this was to back up my data, wipe my partition, and reinstall Debian (with GNOME instead of Cinnamon 😉).

I have the web-greeter up and running as lightdm-webkit2-greeter and it works beautifully, though I'm currently working out some kinks with my current theme. I also made sure to keep my python development environment separate from the system-dependent python installation by using Anaconda (highly recommend!). Not sure if this is the ideal solution, but I felt it was better to start from scratch than struggle trying to figure out how to fix my mangled python installation.