Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConnectionError: Did not receive Dummy Byte!

See original GitHub issue

I’m trying to write a simplest demo like

from adbutils import adb
import scrcpy

def on_frame(frame):
    if frame is not None:

device = adb.device()

client = scrcpy.Client(
            max_width=540, device=device)
client.add_listener(scrcpy.EVENT_FRAME, on_frame)

while client.alive:

for the hardware setting, i only have a phone with USB cable connected. all run in Ubuntu 16.04, python 3.9.5,

here is the conda list

# packages in environment at /home/alex/anaconda3/envs/tf2:
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             4.5                       1_gnu    defaults
_tflow_select             2.1.0                       gpu    defaults
absl-py                   0.13.0           py39h06a4308_0    defaults
adbutils                  0.11.0                   pypi_0    pypi
aiohttp                   3.7.4            py39h27cfd23_1    defaults
apkutils2                 1.0.0                    pypi_0    pypi
argon2-cffi               20.1.0           py39h27cfd23_1    defaults
astor                     0.8.1            py39h06a4308_0    defaults
astunparse                1.6.3                      py_0    defaults
async-timeout             3.0.1            py39h06a4308_0    defaults
async_generator           1.10               pyhd3eb1b0_0    defaults
attrs                     21.2.0             pyhd3eb1b0_0    defaults
av                        8.0.3            py39h7b1e1d3_0    conda-forge
backcall                  0.2.0              pyhd3eb1b0_0    defaults
blas                      1.0                         mkl    defaults
bleach                    4.0.0              pyhd3eb1b0_0    defaults
blinker                   1.4              py39h06a4308_0    defaults
brotlipy                  0.7.0           py39h27cfd23_1003    defaults
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.17.1               h27cfd23_0    defaults
ca-certificates           2021.5.30            ha878542_0    conda-forge
cachetools                4.2.2              pyhd3eb1b0_0    defaults
certifi                   2021.5.30        py39h06a4308_0    defaults
cffi                      1.14.6           py39h400218f_0    defaults
chardet                   3.0.4           py39h06a4308_1003    defaults
cigam                     0.0.3                    pypi_0    pypi
click                     8.0.1              pyhd3eb1b0_0    defaults
coverage                  5.5              py39h27cfd23_2    defaults
cryptography              3.4.7            py39hd23ed53_0    defaults
cudatoolkit               10.1.243             h6bb024c_0    defaults
cudnn                     7.6.5                cuda10.1_0    defaults
cupti                     10.1.168                      0    defaults
cython                    0.29.24          py39h295c915_0    defaults
dbus                      1.13.18              hb2f20db_0    defaults
decorator                 5.0.9              pyhd3eb1b0_0    defaults
defusedxml                0.7.1              pyhd3eb1b0_0    defaults
deprecation               2.1.0                    pypi_0    pypi
entrypoints               0.3              py39h06a4308_0    defaults
expat                     2.4.1                h2531618_2    defaults
ffmpeg                    4.3.2                hca11adc_0    conda-forge
fontconfig                2.13.1               h6c09931_0    defaults
freetype                  2.10.4               h5ab3b9f_0    defaults
gast                      0.4.0                      py_0    defaults
glib                      2.69.0               h5202010_0    defaults
gmp                       6.2.1                h58526e2_0    conda-forge
gnutls                    3.6.13               h85f3911_1    conda-forge
google-auth               1.33.0             pyhd3eb1b0_0    defaults
google-auth-oauthlib      0.4.4              pyhd3eb1b0_0    defaults
google-pasta              0.2.0                      py_0    defaults
grpcio                    1.36.1           py39h2157cd5_1    defaults
gst-plugins-base          1.14.0               h8213a91_2    defaults
gstreamer                 1.14.0               h28cd5cc_2    defaults
h5py                      2.10.0           py39hec9cf62_0    defaults
hdf5                      1.10.6               hb1b8bf9_0    defaults
icu                       58.2                 he6710b0_3    defaults
idna                      2.10               pyhd3eb1b0_0    defaults
importlib-metadata        3.10.0           py39h06a4308_0    defaults
importlib_metadata        3.10.0               hd3eb1b0_0    defaults
intel-openmp              2021.3.0          h06a4308_3350    defaults
ipykernel                 5.3.4            py39hb070fc8_0    defaults
ipython                   7.26.0           py39hb070fc8_0    defaults
ipython_genutils          0.2.0              pyhd3eb1b0_1    defaults
ipywidgets                7.6.3              pyhd3eb1b0_1    defaults
jedi                      0.18.0           py39h06a4308_1    defaults
jinja2                    3.0.1              pyhd3eb1b0_0    defaults
jpeg                      9b                   h024ee3a_2    defaults
jsonschema                3.2.0                      py_2    defaults
jupyter                   1.0.0            py39h06a4308_7    defaults
jupyter_client            6.1.12             pyhd3eb1b0_0    defaults
jupyter_console           6.4.0              pyhd3eb1b0_0    defaults
jupyter_core              4.7.1            py39h06a4308_0    defaults
jupyterlab_pygments       0.1.2                      py_0    defaults
jupyterlab_widgets        1.0.0              pyhd3eb1b0_1    defaults
keras-preprocessing       1.1.2              pyhd3eb1b0_0    defaults
lame                      3.100             h7f98852_1001    conda-forge
lcms2                     2.12                 h3be6417_0    defaults
ld_impl_linux-64          2.35.1               h7274673_9    defaults
libffi                    3.3                  he6710b0_2    defaults
libgcc-ng                 9.3.0               h5101ec6_17    defaults
libgfortran-ng            7.5.0               ha8ba4b0_17    defaults
libgfortran4              7.5.0               ha8ba4b0_17    defaults
libgomp                   9.3.0               h5101ec6_17    defaults
libpng                    1.6.37               hbc83047_0    defaults
libprotobuf               3.17.2               h4ff587b_1    defaults
libsodium                 1.0.18               h7b6447c_0    defaults
libstdcxx-ng              9.3.0               hd4cf53a_17    defaults
libtiff                   4.1.0                h2733197_1    defaults
libuuid                   1.0.3                h1bed415_2    defaults
libxcb                    1.14                 h7b6447c_0    defaults
libxml2                   2.9.12               h03d6c58_0    defaults
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
markdown                  3.3.4            py39h06a4308_0    defaults
markupsafe                2.0.1            py39h27cfd23_0    defaults
matplotlib-inline         0.1.2              pyhd3eb1b0_2    defaults
mistune                   0.8.4           py39h27cfd23_1000    defaults
mkl                       2021.3.0           h06a4308_520    defaults
mkl-service               2.4.0            py39h7f8727e_0    defaults
mkl_fft                   1.3.0            py39h42c9631_2    defaults
mkl_random                1.2.2            py39h51133e4_0    defaults
multidict                 5.1.0            py39h27cfd23_2    defaults
nbclient                  0.5.3              pyhd3eb1b0_0    defaults
nbconvert                 6.1.0            py39h06a4308_0    defaults
nbformat                  5.1.3              pyhd3eb1b0_0    defaults
ncurses                   6.2                  he6710b0_1    defaults
nest-asyncio              1.5.1              pyhd3eb1b0_0    defaults
nettle                    3.6                  he412f7d_0    conda-forge
notebook                  6.4.2            py39h06a4308_0    defaults
numpy                     1.19.5                   pypi_0    pypi
numpy-base                1.20.3           py39h74d4b33_0    defaults
oauthlib                  3.1.1              pyhd3eb1b0_0    defaults
olefile                   0.46               pyh9f0ad1d_1    conda-forge
opencv-python                    pypi_0    pypi
openh264                  2.1.1                h780b84a_0    conda-forge
openjpeg                  2.4.0                hf7af979_0    conda-forge
openssl                   1.1.1k               h27cfd23_0    defaults
opt_einsum                3.3.0              pyhd3eb1b0_1    defaults
packaging                 21.0               pyhd3eb1b0_0    defaults
pandocfilters             1.4.3            py39h06a4308_1    defaults
parso                     0.8.2              pyhd3eb1b0_0    defaults
pcre                      8.45                 h295c915_0    defaults
pexpect                   4.8.0              pyhd3eb1b0_3    defaults
pickleshare               0.7.5           pyhd3eb1b0_1003    defaults
pillow                    8.3.1            py39h2c7a002_0    defaults
pip                       21.1.3           py39h06a4308_0    defaults
prometheus_client         0.11.0             pyhd3eb1b0_0    defaults
prompt-toolkit            3.0.17             pyh06a4308_0    defaults
prompt_toolkit            3.0.17               hd3eb1b0_0    defaults
protobuf                  3.17.2           py39h295c915_0    defaults
ptyprocess                0.7.0              pyhd3eb1b0_2    defaults
py                        1.10.0                   pypi_0    pypi
pyasn1                    0.4.8                      py_0    defaults
pyasn1-modules            0.2.8                      py_0    defaults
pycparser                 2.20                       py_2    defaults
pyelftools                0.27                     pypi_0    pypi
pygments                  2.9.0              pyhd3eb1b0_0    defaults
pyjwt                     2.1.0            py39h06a4308_0    defaults
pyopenssl                 20.0.1             pyhd3eb1b0_1    defaults
pyparsing                 2.4.7              pyhd3eb1b0_0    defaults
pyqt                      5.9.2            py39h2531618_6    defaults
pyrsistent                0.18.0           py39h7f8727e_0    defaults
pyside6                   6.1.3                    pypi_0    pypi
pysocks                   1.7.1            py39h06a4308_0    defaults
python                    3.9.5                h12debd9_4    defaults
python-dateutil           2.8.2              pyhd3eb1b0_0    defaults
python-flatbuffers        1.12               pyhd3eb1b0_0    defaults
python_abi                3.9                      2_cp39    conda-forge
pyyaml                    5.4.1            py39h27cfd23_1    defaults
pyzmq                     22.2.1           py39h295c915_1    defaults
qt                        5.9.7                h5867ecd_1    defaults
qtconsole                 5.1.0              pyhd3eb1b0_0    defaults
readline                  8.1                  h27cfd23_0    defaults
requests                  2.25.1             pyhd3eb1b0_0    defaults
requests-oauthlib         1.3.0                      py_0    defaults
retry                     0.9.2                    pypi_0    pypi
rsa                       4.7.2              pyhd3eb1b0_1    defaults
scipy                     1.6.2            py39had2a1c9_1    defaults
scrcpy-client             0.3.4                    pypi_0    pypi
send2trash                1.5.0              pyhd3eb1b0_1    defaults
setuptools                52.0.0           py39h06a4308_0    defaults
shiboken6                 6.1.3                    pypi_0    pypi
sip                       4.19.13          py39h2531618_0    defaults
six                       1.16.0             pyhd3eb1b0_0    defaults
sqlite                    3.36.0               hc218d9a_0    defaults
tensorboard               2.4.0              pyhc547734_0    defaults
tensorboard-plugin-wit    1.6.0                      py_0    defaults
tensorflow                2.4.1           gpu_py39h8236f22_0    defaults
tensorflow-base           2.4.1           gpu_py39h29c2da4_0    defaults
tensorflow-estimator      2.5.0              pyh7b7c402_0    defaults
tensorflow-gpu            2.4.1                h30adc30_0    defaults
termcolor                 1.1.0            py39h06a4308_1    defaults
terminado                 0.9.4            py39h06a4308_0    defaults
testpath                  0.5.0              pyhd3eb1b0_0    defaults
tk                        8.6.10               hbc83047_0    defaults
tornado                   6.1              py39h27cfd23_0    defaults
traitlets                 5.0.5              pyhd3eb1b0_0    defaults
typing-extensions             hd3eb1b0_0    defaults
typing_extensions           pyh06a4308_0    defaults
tzdata                    2021a                h52ac0ba_0    defaults
urllib3                   1.26.6             pyhd3eb1b0_1    defaults
wcwidth                   0.2.5                      py_0    defaults
webencodings              0.5.1            py39h06a4308_1    defaults
werkzeug                  1.0.1              pyhd3eb1b0_0    defaults
wheel                     0.36.2             pyhd3eb1b0_0    defaults
whichcraft                0.6.1                    pypi_0    pypi
widgetsnbextension        3.5.1            py39h06a4308_0    defaults
wrapt                     1.12.1           py39he8ac12f_1    defaults
x264                      1!161.3030           h7f98852_1    conda-forge
xmltodict                 0.12.0                   pypi_0    pypi
xz                        5.2.5                h7b6447c_0    defaults
yaml                      0.2.5                h7b6447c_0    defaults
yarl                      1.6.3            py39h27cfd23_0    defaults
zeromq                    4.3.4                h2531618_0    defaults
zipp                      3.5.0              pyhd3eb1b0_0    defaults
zlib                      1.2.11               h7b6447c_3    defaults
zstd                      1.4.9                ha95c52a_0    conda-forge

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

leng-yuecommented, Sep 18, 2021

No, this works as expected. It is used to detect whether the QT window is closed. While QT is not closed, the program should reconnect after users change the device.

leng-yuecommented, Sep 17, 2021

I think the problem is that you started the server twice.
Can you try:

from adbutils import adb
import scrcpy

def on_frame(frame):
    if frame is not None:

device = adb.device()

client = scrcpy.Client(
            max_width=540, device=device)
client.add_listener(scrcpy.EVENT_FRAME, on_frame)


And if you want to start the client in an independent thread, you can use client.start(threaded=True), and the main loop won’t be blocked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when using scrcpy-server directly · Issue #613 - GitHub
Then I run a python script just like #129 , I can get the dummy byte (0), but I can't get the next...
Read more >
An existing connection was forcibly closed by the remote host
The 0#0 simply means that nothing was sent because the socket was already closed. The connection is still open, and a packet of...
Read more >
Creating Responses - Requests-Mock - Read the Docs
A python object that will be converted to a JSON string. text: A unicode string. This is typically what you will want to...
Read more >
Client Reference — aiohttp 3.8.3 documentation
One example is not processing cookies at all when working in proxy mode. If no cookie processing is needed, a aiohttp.DummyCookieJar instance can...
Read more >
Web Requests with Python - Pluralsight
HTTP requests are composed of methods like GET, POST, PUT, ... This dummy post request will return the attached data as response body:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found