xpra icon
Bug tracker and wiki

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#2835 closed defect (fixed)

UnboundLocalError: local variable 'app' referenced before assignment

Reported by: stdedos Owned by: stdedos
Priority: major Milestone: 4.1
Component: client Version: 3.0.x
Keywords: Cc:

Description (last modified by stdedos)

$ xpra --version
xpra v4.1-r26851
$ xpra start ssh://u@h --start=gnome-terminal
xpra main error:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 2020, in run_remote_server
    app = make_client(error_cb, opts)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1922, in make_client
    return app
UnboundLocalError: local variable 'app' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 126, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 367, in run_mode
    return do_run_mode(script_file, error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 375, in do_run_mode
    return run_remote_server(error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 2034, in run_remote_server
    app.show_progress(100, "failure: %s" % e)
UnboundLocalError: local variable 'app' referenced before assignment

Change History (14)

comment:1 Changed 2 months ago by Antoine Martin

Owner: changed from Antoine Martin to stdedos

I am unable to reproduce with the current 4.1 beta builds.

Please try updating.

comment:2 Changed 2 months ago by stdedos

I temporarily solved it by downgrading (r26759 i.e. before r26813).
I'll check updating tomorrow.

comment:3 Changed 2 months ago by stdedos

Description: modified (diff)

comment:4 Changed 2 months ago by stdedos

I really don't know what to tell you

$ xpra --version
xpra v4.1-r26935
$ xpra start ssh://u@h --start=gnome-terminal
xpra main error:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 2019, in run_remote_server
    app = make_client(error_cb, opts)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1921, in make_client
    return app
UnboundLocalError: local variable 'app' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 126, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 367, in run_mode
    return do_run_mode(script_file, error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 375, in do_run_mode
    return run_remote_server(error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 2033, in run_remote_server
    app.show_progress(100, "failure: %s" % e)
UnboundLocalError: local variable 'app' referenced before assignment

Does it matter that I am connecting to my Xenial server? :/

comment:5 Changed 2 months ago by Antoine Martin

Sorry about that, I should have read the backtrace more carefully.
r26946 will fix the 2 bugs I could find by inspecting the code, but I suspect that the underlying problem is not yet fixed.

You client must be triggering some exception which was hitting those two bugs. I never hit any on my test systems, so it would be good to know what the difference is. Are you using --ssh=putty perhaps? (I've tried with --ssh=ssh on Linux, no help)

At least now, we will be able to see it.
New beta builds uploaded.

Does it matter that I am connecting to my Xenial server? :/

No, it doesn't get that far.

Last edited 2 months ago by Antoine Martin (previous) (diff)

comment:6 in reply to:  5 Changed 2 months ago by stdedos

Replying to Antoine Martin:

At least now, we will be able to see it.
New beta builds uploaded.

Ooops. I assume you meant new Windows beta builds, this is from Bionic client.
My bad.

Note that I am not updating to 4.1.x on Windows - it is painful these days to battle lag/disconnections.

comment:7 Changed 2 months ago by Antoine Martin

I assume you meant new Windows beta builds, this is from Bionic client.

Updated Bionic beta builds have been uploaded too.

Note that I am not updating to 4.1.x on Windows - it is painful these days to battle lag/disconnections.

Are you saying that lag and disconnections are worse in 4.1?
Odd. There are no changes in that area. Is there a specific ticket for that?

comment:8 in reply to:  7 Changed 2 months ago by stdedos

Replying to Antoine Martin:

I assume you meant new Windows beta builds, this is from Bionic client.

Updated Bionic beta builds have been uploaded too.

Weird - I tried navigating the Bionic repo manually at the time, there wasn't anything. I can try again on Monday.

Note that I am not updating to 4.1.x on Windows - it is painful these days to battle lag/disconnections.

Are you saying that lag and disconnections are worse in 4.1?
Odd. There are no changes in that area. Is there a specific ticket for that?

Lag / Disconnections maim the experience, and the Headerbar just kill the rest of it. There is no luck of "recovering", after windows start moving around, maximization-does-not-really-maximize etc

Last edited 2 months ago by Antoine Martin (previous) (diff)

comment:9 Changed 2 months ago by Antoine Martin

I tried navigating the Bionic repo manually at the time

Ah. Maybe just missed.

Lag / Disconnections? maim the experience,

And this is in 4.1 client only? How strange.

and the Headerbar just kill the rest of it.

  • I'm not quite clear on what the problem is with it since the window sizing issues are meant to be fixed - was there anything else wrong with it?
  • in any case, the headerbar is optional: --headerbar=no

There is no luck of "recovering", after windows start moving around,

Windows start moving around? On their own?

maximization-does-not-really-maximize etc

Huh? What does it do for you?

Last edited 2 months ago by Antoine Martin (previous) (diff)

comment:10 in reply to:  9 Changed 2 months ago by stdedos

Replying to Antoine Martin:

I tried navigating the Bionic repo manually at the time

Ah. Maybe just missed.

Lag / Disconnections? maim the experience,

And this is in 4.1 client only? How strange.

"Somewhat amplified". Take it with a grain of salt though; connection quality (from xpra's viewpoint and/or the "real" status) are blackbox to me, and they seem to change (e.g. 01.06 was like a Zero-day bug from my viewpoint - nothing high-level connected anywhere via VPN).

and the Headerbar just kill the rest of it.

  • I'm not quite clear on what the problem is with it since the window sizing issues are meant to be fixed - was there anything else wrong with it?
  • in any case, the headerbar is optional: --headerbar=no

e.g. #2747 (and I'll keep digging the old tickets for leftovers when I stop creating new ones :-p)

There is no luck of "recovering", after windows start moving around,

Windows start moving around? On their own?

Variant of #2457 /w headerbar=on

maximization-does-not-really-maximize etc

Huh? What does it do for you?

Variant of #2747.


In any case, here is your stacktrace:

$ xpra start ssh://u@h --start=gnome-terminal
xpra main error:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 126, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 367, in run_mode
    return do_run_mode(script_file, error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 375, in do_run_mode
    return run_remote_server(error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 2021, in run_remote_server
    app = make_client(error_cb, opts)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1905, in make_client
    from xpra.client.gtk3.client import XpraClient
  File "/usr/lib/python3/dist-packages/xpra/client/gtk3/client.py", line 9, in <module>
    from xpra.client.gtk_base.gtk_client_base import GTKXpraClient
  File "/usr/lib/python3/dist-packages/xpra/client/gtk_base/gtk_client_base.py", line 12, in <module>
    from xpra.client.gtk_base.gtk_client_window_base import HAS_X11_BINDINGS, XSHAPE
  File "/usr/lib/python3/dist-packages/xpra/client/gtk_base/gtk_client_window_base.py", line 61, in <module>
    from xpra.x11.gtk_x11.prop import prop_get, prop_set, prop_del
  File "/usr/lib/python3/dist-packages/xpra/x11/gtk_x11/prop.py", line 21, in <module>
    from xpra.x11.gtk_x11.gdk_bindings import (
  File "/usr/lib/python3/dist-packages/xpra/x11/gtk_x11/gdk_bindings.py", line 13, in <module>
    get_pywindow                = gdk_bindings.get_pywindow
AttributeError: module 'xpra.x11.gtk3.gdk_bindings' has no attribute 'get_pywindow'

Note that this is now xpra-over-ssh-X-session, so YMMV.

Last edited 2 months ago by stdedos (previous) (diff)

comment:11 Changed 2 months ago by Antoine Martin

In any case, here is your stacktrace:

Right, now we're getting somewhere, I hope.

There's something odd going on.
You're running the client on a Linux system, and the client loads its X11 bindings but fails half way through with a completely unexpected exception (AttributeError instead of the more common ImportError on systems without X11).

What's really strange is how gdk_bindings is only failing on get_pywindow (which has existed for a very long time in the Cython bindings), and not before.

Can you please try running this instead of xpra start ..:

python3 -c "from xpra.x11.gtk3.gdk_bindings import get_pywindow"
python3 -c "import xpra.x11.gtk_x11.gdk_bindings"
python3 -c "from xpra.x11.gtk_x11.gdk_bindings import get_pywindow"

They should all work. Though you may see a Unable to init server: Could not connect: Connection refused warning when there is no valid X11 $DISPLAY defined.

Works for me with both ssh -Y and ssh -X sessions.

comment:12 Changed 2 months ago by stdedos

😂

$ python3 -c "from xpra.x11.gtk3.gdk_bindings import get_pywindow"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "xpra/x11/gtk3/gdk_bindings.pyx", line 21, in init xpra.x11.gtk3.gdk_bindings
ModuleNotFoundError: No module named 'xpra.gtk_common.quit'
$ python3 -c "import xpra.x11.gtk_x11.gdk_bindings"python3 -c "import xpra.x11.gtk_x11.gdk_bindings"^C
$ python3 -c "import xpra.x11.gtk_x11.gdk_bindings"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/xpra/x11/gtk_x11/gdk_bindings.py", line 11, in <module>
    from xpra.x11.gtk3 import gdk_bindings  #@UnresolvedImport, @UnusedImport
  File "xpra/x11/gtk3/gdk_bindings.pyx", line 21, in init xpra.x11.gtk3.gdk_bindings
ModuleNotFoundError: No module named 'xpra.gtk_common.quit'
$ python3 -c "from xpra.x11.gtk_x11.gdk_bindings import get_pywindow"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/xpra/x11/gtk_x11/gdk_bindings.py", line 11, in <module>
    from xpra.x11.gtk3 import gdk_bindings  #@UnresolvedImport, @UnusedImport
  File "xpra/x11/gtk3/gdk_bindings.pyx", line 21, in init xpra.x11.gtk3.gdk_bindings
ModuleNotFoundError: No module named 'xpra.gtk_common.quit'
$ 

Clean installation? 😕

comment:13 Changed 2 months ago by Antoine Martin

Resolution: fixed
Status: newclosed

Clean installation? 😕

Ah, dammit. Fixed in r26972.

(I had the old copy in my build cache - sorry about that)

The fix would normally be trivial to apply (one liner), but this is a cython file that gets compiled, so you may want to just do this instead:

cat >> /path/to/xpra/gtk_common/quit.py <<EOF
def gtk_main_quit_really():
    pass
EOF

Until I upload newer builds.

Version 0, edited 2 months ago by Antoine Martin (next)

comment:14 Changed 2 months ago by stdedos

Tests, workaround, and connection work :-D

Last edited 2 months ago by stdedos (previous) (diff)
Note: See TracTickets for help on using tickets.