Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update. #3

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion doc/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
※ Change to the IP address (v4) specified by your WSL2

#### Check python's parent process ID at startup

```markdown
import os

Expand All @@ -15,6 +14,34 @@ pid = os.getppid()
# Need to check at startup
print(f"Parent Process ID: {pid}")
```
### Add this to the top of your python file to start debugging
```python
import debugpy
import os

from typing import Optional```
def debug_wait_for_attach(listen_to):
scoop = os.path.expanduser('~/scoop/apps/python/current/python.exe')
pyenv: Optional[str] = os.path.expanduser('/.pyenv/shims/python')
ay: Optional[str] = os.path.expanduser('/.anyenv/envs/pyenv/shims/python')

if os.path.exists(os.path.expanduser(scoop)):
# use scoop
debugpy.configure(python=str(scoop))
debugpy.listen(listen_to)
debugpy.wait_for_client()
elif os.path.exists(pyenv):
# ~/.pyenv
debugpy.configure(python=str(pyenv))
debugpy.listen(listen_to)
debugpy.wait_for_client()
elif os.path.exists(ay):
# ~/.anyenv
debugpy.configure(python=str(ay))
debugpy.listen(listen_to)
debugpy.wait_for_client()
```
※ scoop/.pyenv/anyenv, add other paths yourself

> python -m debugpy --wait-for-client --listen 5678 facematch.py ${@:2}

Expand Down