Skip to content

Error with --'no-gui' on Linux without X-server #54

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
gegu opened this issue Aug 23, 2022 · 6 comments
Closed

Error with --'no-gui' on Linux without X-server #54

gegu opened this issue Aug 23, 2022 · 6 comments

Comments

@gegu
Copy link

gegu commented Aug 23, 2022

Today I tried to run the script with the argument --no-gui on a Linux installation without X-server and got the following error on import pystray:

Traceback (most recent call last):
  File "emailproxy.py", line 39, in <module>
    import pystray
  File "~/emailproxy/.env/lib/python3.7/site-packages/pystray/__init__.py", line 64, in <module>
    Icon = backend().Icon
  File "~/emailproxy/.env/lib/python3.7/site-packages/pystray/__init__.py", line 56, in backend
    return candidate()
  File "~/emailproxy/.env/lib/python3.7/site-packages/pystray/__init__.py", line 36, in xorg
    from . import _xorg as backend; return backend
  File "~/emailproxy/.env/lib/python3.7/site-packages/pystray/_xorg.py", line 36, in <module>
    display = Xlib.display.Display()
  File "~/emailproxy/.env/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "~/emailproxy/.env/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "~/emailproxy/.env/lib/python3.7/site-packages/Xlib/protocol/display.py", line 84, in __init__
    name, protocol, host, displayno, screenno = connect.get_display(display)
  File "~/emailproxy/.env/lib/python3.7/site-packages/Xlib/support/connect.py", line 73, in get_display
    return mod.get_display(display)
  File "~/emailproxy/.env/lib/python3.7/site-packages/Xlib/support/unix_connect.py", line 76, in get_display
    raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""

I was able to fix the problem by only importing pystray when the --no-gui argument was not specified.

if not '--no-gui' in sys.argv: import pystray

Maybe this will help someone who also tries this.

Thanks for your great project 👍

@gegu
Copy link
Author

gegu commented Aug 23, 2022

Sorry, I overlooked the branch requirements-no-gui.

@gegu gegu closed this as completed Aug 23, 2022
@simonrob
Copy link
Owner

Thanks for this report. The proxy was originally designed as a GUI-first application given the need for interaction to actually authenticate an account.

Let me know how you get on with the requirements-no-gui branch, which should simplify things in situations like yours – I'm happy to merge this branch if it is useful.

@gegu
Copy link
Author

gegu commented Aug 23, 2022

I have the main branch in use again, since I was affected by #50.

Maybe you can merge the main branch into requirements-no-gui, then I like to test again.

@simonrob
Copy link
Owner

Done

@gegu
Copy link
Author

gegu commented Aug 23, 2022

export EMAIL_OAUTH2_PROXY_REQUIREMENTS_NO_GUI=true ; python3 emailproxy.py --no-gui --local-server-auth

Looks good after initial tests.

Tomorrow I will test more extensively and then report again.

Thanks

@gegu
Copy link
Author

gegu commented Aug 24, 2022

Work like a charm 👍 Tested under linux (Debian) and windows.

simonrob added a commit that referenced this issue Aug 24, 2022
Simplifies installation in headless / no-GUI environments (see, e.g., #1, #2, #11, #41, #45, 48, #49, #54, #55)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants