Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

can't run python4andorid in debugger in vscode because shprint does not seem to work well in debugpy

Open
#3,175 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start with the minimal reproduction using shprint, sh.basename, and the /a/Python-3.11.5.tgz path, then compare plain execution with the VS Code debugpy command shown. Trace the python3 recipe path where sh.basename is called. Done means the build can run under debugpy without the bad-file-descriptor failure while plain sh continues to work.

Written by the indexing model from the issue text.

Description

need-analysis platform-linux

The debgger used in vscode, debugpy, seems to not be able to run bulldozer because of code in python-for-android. When running a build sh.basename is called in the python3 recipe. The code is a more complex version of this code:

from pythonforandroid.logger import shprint
import sh

print(shprint(sh.basename, '/a/Python-3.11.5.tgz'))

When running without the debugger this works fine, but with the debugger I get:

 cd /home/guy/workspace/hand_tracker ; /usr/bin/env /home/guy/vpy/bin/python /home/guy/.vscode-oss/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 59539 -- /tmp/reproduce.py 
[INFO]:    -> running basename /a/Python-3.11.5.tgz
Traceback (most recent call last):                                                                                      
  File "/home/guy/.vscode-oss/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 422, in _on_run
    cmd.send(self.sock)
  File "/home/guy/.vscode-oss/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py", line 111, in send
    sock.sendall(("Content-Length: %s\r\n\r\n" % len(as_bytes)).encode("ascii"))
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/guy/.vscode-oss/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 53, in run
    self._on_run()
  File "/home/guy/.vscode-oss/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 432, in _on_run
    self.py_db.dispose_and_kill_all_pydevd_threads()
  File "/home/guy/.vscode-oss/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py", line 2558, in dispose_and_kill_all_pydevd_threads
    self._client_socket.close()
  File "/usr/lib/python3.11/socket.py", line 503, in close
    self._real_close()
  File "/usr/lib/python3.11/socket.py", line 497, in _real_close
    _ss.close(self)
OSError: [Errno 9] Bad file descriptor
6.71s - pydevd: Sending message related to process being replaced timed-out after 5 seconds
Python-3.11.5.tgz

Plain sh works fine.

Dominant language
Python
Stars
8.9k
Forks
2k
Avg merge
12h 20m
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kivy/python-for-android

All issues in kivy/python-for-android

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.