xpra icon
Bug tracker and wiki

Opened 2 weeks ago

Closed 10 days ago

Last modified 10 days ago

#2494 closed defect (fixed)

bug in platform/xposix/keyboard.py

Reported by: rozenkno Owned by: rozenkno
Priority: blocker Milestone: 4.0
Component: keyboard Version: 3.0.x
Keywords: Cc:

Description (last modified by Antoine Martin)

Launching « xpra start » on Fedora, I get this error :

xpra main error:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/xpra/scripts/main.py", line 110, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib64/python3.7/site-packages/xpra/scripts/main.py", line 333, in run_mode
    return run_remote_server(error_cb, options, args, mode, defaults)
  File "/usr/lib64/python3.7/site-packages/xpra/scripts/main.py", line 1905, in run_remote_server
    app.init_ui(opts)
  File "/usr/lib64/python3.7/site-packages/xpra/client/ui_client_base.py", line 189, in init_ui
    opts.keyboard_raw, *overrides)
  File "/usr/lib64/python3.7/site-packages/xpra/client/gtk_base/gtk_keyboard_helper.py", line 30, in __init__
    self.update()
  File "/usr/lib64/python3.7/site-packages/xpra/client/gtk_base/gtk_keyboard_helper.py", line 63, in update
    self.query_xkbmap()
  File "/usr/lib64/python3.7/site-packages/xpra/client/keyboard_helper.py", line 352, in query_xkbmap
    ) = self.get_layout_spec()
  File "/usr/lib64/python3.7/site-packages/xpra/client/keyboard_helper.py", line 305, in get_layout_spec
    layout, layouts, variant, variants, options = self.keyboard.get_layout_spec()
  File "/usr/lib64/python3.7/site-packages/xpra/platform/xposix/keyboard.py", line 142, in get_layout_spec
    locale = self.get_locale_status()
  File "/usr/lib64/python3.7/site-packages/xpra/platform/xposix/keyboard.py", line 89, in get_locale_status
    parts = line.lstrip(" ").split(": ")
TypeError: a bytes-like object is required, not 'str'

proposed bugfix : replace line 89 in /usr/lib64/python3.7/site-packages/xpra/platform/xposix/keyboard.py by :

    parts = line.lstrip(b" ").split(b": ")

Change History (4)

comment:1 Changed 2 weeks ago by Antoine Martin

Description: modified (diff)
Resolution: fixed
Status: newclosed

Thanks!

The fix is correct and has been applied in r24499.
Not sure why I didn't hit it before you did as I use Fedora for development and testing.

comment:2 Changed 13 days ago by Antoine Martin

Resolution: fixed
Status: closedreopened
019-11-28 16:12:14,368 failed to start client
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/xpra/client/gtk_base/client_launcher.py", line 820, in start_XpraClient
    self.do_start_XpraClient(conn, display_desc)
  File "/usr/lib64/python3.7/site-packages/xpra/client/gtk_base/client_launcher.py", line 829, in do_start_XpraClient
    self.client.init_ui(self.config)
  File "/usr/lib64/python3.7/site-packages/xpra/client/ui_client_base.py", line 187, in init_ui
    opts.keyboard_raw, *overrides)
  File "/usr/lib64/python3.7/site-packages/xpra/client/gtk_base/gtk_keyboard_helper.py", line 27, in __init__
    self.update()
  File "/usr/lib64/python3.7/site-packages/xpra/client/gtk_base/gtk_keyboard_helper.py", line 60, in update
    self.query_xkbmap()
  File "/usr/lib64/python3.7/site-packages/xpra/client/keyboard_helper.py", line 352, in query_xkbmap
    ) = self.get_layout_spec()
  File "/usr/lib64/python3.7/site-packages/xpra/client/keyboard_helper.py", line 305, in get_layout_spec
    layout, layouts, variant, variants, options = self.keyboard.get_layout_spec()
  File "/usr/lib64/python3.7/site-packages/xpra/platform/xposix/keyboard.py", line 138, in get_layout_spec
    locale = self.get_locale_status()
  File "/usr/lib64/python3.7/site-packages/xpra/platform/xposix/keyboard.py", line 85, in get_locale_status
    parts = line.lstrip(b" ").split(b": ")
TypeError: lstrip arg must be None or str

This "fix" breaks things for me.

comment:3 Changed 13 days ago by Antoine Martin

Owner: changed from Antoine Martin to rozenkno
Status: reopenednew

The python documentation for subprocess.getoutput clearly states: Like getstatusoutput(), except the exit code is ignored and the return value is a string containing the command’s output.

So I am reverting r24499 in r24507.

Please try:

$ python3 -c 'from subprocess import getoutput;print(type(getoutput("localectl status")))'
<class 'str'>

It should be a string, and if it isn't then there's something fishy with your system's python3.

comment:4 Changed 10 days ago by Antoine Martin

Resolution: fixed
Status: newclosed

r24542 is a better / safer fix.

Not heard back so closing.

I still believe that there's something wrong with your system python3, but without further information, it's impossible to tell what.

Last edited 10 days ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.