Xpra: Ticket #2621: bug-report: Screenshot.png is not an image

From r25468:

$ file Screenshot.png
Screenshot.png: ASCII text, with very long lines, with no line terminators
$ head -c 20 Screenshot.png ; echo
b'\x89PNG\r\n\x1a\n\
$

xpra info "collected" via right-click menu on Windows 10



Wed, 04 Mar 2020 15:22:03 GMT - stdedos: description changed


Thu, 05 Mar 2020 04:53:49 GMT - Antoine Martin: status changed

I think I know where the problem is. The usual strings vs bytes python nonsense.


Thu, 05 Mar 2020 05:00:11 GMT - Antoine Martin: owner, status changed

Hmmm. No. I can't reproduce the problem. Please attach the file.

Please specify the exact versions used at both ends, as well as the distro version.


Thu, 05 Mar 2020 07:51:25 GMT - stdedos:

Server: Xenial / r25174, Client: Win10 / r25468

Screenshot is not really needed. If I do:

a = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR....'
with open('Screenshot.png', 'wb') as f:
    f.write(a)

It will save the screenshot as expected (It will take some time to paste 450kb chars in the terminal, but it will happen).


Thu, 05 Mar 2020 09:01:05 GMT - Antoine Martin:

I cannot reproduce any problems. Tested with 3.0.6-r25174 on a Xenial server and win10 client as well as xenial client.

Tested with python2 and python3 versions of the client and server.

You must have left some important detail out. For a start, the python version(s) used and the exact command lines.


Thu, 05 Mar 2020 09:16:36 GMT - stdedos:

I don't know if you checked - does this help? attachment/ticket/2618/xpra-2618-info.zip

I opened this as a consequence of #2618.


Thu, 05 Mar 2020 09:44:38 GMT - Antoine Martin:

I don't know if you checked - does this help? attachment/ticket/2618/xpra-2618-info.zip

No. But this would:

You must have left some important detail out. For a start, the python version(s) used and the exact command lines.


Thu, 05 Mar 2020 21:20:21 GMT - stdedos:

xpra-info collected from this session:

"Xpra-Python3-x86_64_4.0-r25519\xpra_cmd" attach ssh://user@ip/0 --ssh="plink -ssh -agent" --keyboard-layout=us --keyboard-layouts=us,gr --opengl=no --min-quality=20 --desktop-scaling=0.75
2020-03-05 20:53:24,914 Xpra GTK3 client version 4.0-r25519 64-bit
2020-03-05 20:53:24,916  running on Microsoft Windows 10
2020-03-05 20:53:24,978 Warning: failed to import opencv:
2020-03-05 20:53:24,979  No module named 'cv2'
2020-03-05 20:53:24,979  webcam forwarding is disabled
2020-03-05 20:53:26,055 GStreamer version 1.16.2 for Python 3.8.2 64-bit
2020-03-05 20:53:26,557 keyboard layout code 0x409
2020-03-05 20:53:26,559 identified as 'United States - English' : us
2020-03-05 20:53:27,110  keyboard settings: layout=us
2020-03-05 20:53:27,115  desktop size is 1600x900 with 1 screen:
2020-03-05 20:53:27,116   Default (423x238 mm - DPI: 96x96) workarea: 1600x860
2020-03-05 20:53:27,117     (Standard monitor types) Generic PnP Monitor (309x174 mm - DPI: 131x131)
2020-03-05 20:53:27,117  downscaled to 75%, virtual screen size: 2133x1200
2020-03-05 20:53:27,118   Default (423x238 mm - DPI: 128x128) workarea: 2133x1147
2020-03-05 20:53:27,120     (Standard monitor types) Generic PnP Monitor (309x174 mm - DPI: 175x175)
2020-03-05 20:53:35,019 enabled remote logging
2020-03-05 20:53:35,032 Xpra GTK3 shadow server version 3.0.6-r25174 64-bit
2020-03-05 20:53:35,035  running on Linux Ubuntu 16.04 xenial
2020-03-05 20:53:35,038  remote desktop size is 6400x1440
2020-03-05 20:53:35,060 Attached to 172.16.57.121:22
2020-03-05 20:53:35,069  (press Control-C to detach)
(xpra_cmd:8268): Pango-WARNING **: 20:53:35.748: couldn't load font "Bitstream Vera Sans Not-Rotated 14.662109375", falling back to "Sans Not-Rotated 14.662109375", expect ugly output.
2020-03-05 20:53:36,795 UI thread is now blocked
2020-03-05 20:53:37,462 UI thread is running again, resuming
[...]
2020-03-05 23:10:04,688 server is not responding, drawing spinners over the windows
2020-03-05 23:10:05,078 server is OK again
2020-03-05 23:10:19,892 Warning: long timer waiting time,
2020-03-05 23:10:19,900  UI thread polling waited 1.3 seconds longer than intended (1.8 vs 0.5)
2020-03-05 23:10:27,043 unknown string message: 0xc2aa / 0x220550 / 0x2
2020-03-05 23:11:20,709 Warning: long timer waiting time,
2020-03-05 23:11:20,718  UI thread polling waited 1.7 seconds longer than intended (2.2 vs 0.5)
2020-03-05 23:11:20,939 server is not responding, drawing spinners over the windows
2020-03-05 23:11:21,513 server is OK again
2020-03-05 23:12:11,354 unknown string message: 0xc286 / 0x0 / 0x0
2020-03-05 23:12:21,373 unknown string message: 0xc286 / 0x0 / 0x0
2020-03-05 23:13:36,235 unknown string message: 0xc286 / 0x0 / 0x0
2020-03-05 23:14:58,893 server is not responding, drawing spinners over the windows
2020-03-05 23:14:59,147 server is OK again
2020-03-05 23:15:05,761 unknown string message: 0xc286 / 0x0 / 0x0

Right-click on tray > Information > Bug Report > Save: and I got attachment/ticket/2621/xpra-2620-test.zip

Then, to "render" the image (included in the attachment):

Simply prepend SCREEN = to the file and then:

In [1]: exec(open('Screenshot.png.txt').read())
In [2]: with open('Screenshot.png', 'wb') as f:
   ...:     f.write(SCREEN)
   ...:

Also also, while checking (in the server) that the file is "rendered" correctly:

$ xdg-open Screenshot.png
xdg-open: failed to forward to xpra server using socket '/run/user/1000/xpra/usr-2': write() argument must be str, not bytes

And the image opened remotely


Thu, 05 Mar 2020 21:20:46 GMT - stdedos: attachment set


Sat, 07 Mar 2020 06:00:49 GMT - Antoine Martin: status changed; resolution set

And... the bit I was missing is that you're using the bug report tool with python3 and not the xpra screenshot command.

The fix is in r25535. Backport in r25536.


Sat, 07 Mar 2020 08:28:19 GMT - stdedos: summary changed


Sat, 23 Jan 2021 05:56:16 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2621