Chalice cannot get debugging to work
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
I'm using PyCharm and have tried following all articles available to try and get debugging to work. Ideally I tried getting a configuration to work as below:

but that only resulted in
```
C:\Users\torra\.virtualenvs\nlb-api\Scripts\python.exe C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 53324 --file C:/Users/torra/.virtualenvs/nlb-api/Scripts/chalice.exe local --no-autoreload --port 8080
Connected to pydev debugger (build 212.4746.96)
Traceback (most recent call last):
File "C:\Users\torra\AppData\Local\Programs\Python\Python39\lib\tokenize.py", line 330, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\torra\AppData\Local\Programs\Python\Python39\lib\tokenize.py", line 394, in open
encoding, lines = detect_encoding(buffer.readline)
File "C:\Users\torra\AppData\Local\Programs\Python\Python39\lib\tokenize.py", line 371, in detect_encoding
encoding = find_cookie(first)
File "C:\Users\torra\AppData\Local\Programs\Python\Python39\lib\tokenize.py", line 335, in find_cookie
raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for 'C:/Users/torra/.virtualenvs/nlb-api/Scripts/chalice.exe'
python-BaseException
Process finished with exit code 1
```
I also tried attaching to an existing process but that resulted in:
```
C:\Users\torra\.virtualenvs\nlb-api\Scripts\python.exe C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py --port 56075 --pid 18952
Traceback (most recent call last):
File "C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 88, in
main(process_command_line(sys.argv[1:]))
File "C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 83, in main
add_code_to_python_process.run_python_code(
File "C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 306, in run_python_code_windows
assert resolve_label(process, b'PyGILState_Ensure')
File "C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 266, in resolve_label
address = process.resolve_label(label)
File "C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\winappdbg\module.py", line 1546, in resolve_label
address = self.resolve_label_components(module, function, offset)
File "C:\Users\torra\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.4746.96\plugins\python\helpers\pydev\pydevd_attach_to_process\winappdbg\module.py", line 1635, in resolve_label_components
raise RuntimeError(msg)
RuntimeError: Function b'PyGILState_Ensure' not found in any module
```
Has anyone else been able to get to debug chalice?
Contributor guide
Research direction
Start by reproducing the PyCharm launch using `chalice local --no-autoreload --port 8080`, then compare it with the attempted attach-to-process workflow shown in the report. The two Windows debugger tracebacks need investigation before the affected Chalice entry point or a supported debugging workflow can be identified; done means debugging works or the limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100