# Pdb error while debug python app with serverless launched offline

**URL:** <https://forum.serverless.com/t/pdb-error-while-debug-python-app-with-serverless-launched-offline/7447>\
**Category:** Serverless Framework\
**Created:** [February 20, 2019, 5:07pm UTC](https://forum.serverless.com/t/pdb-error-while-debug-python-app-with-serverless-launched-offline/7447 "2019-02-20T17:07:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bubanoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bubanoid/32/3062_2.png) [@bubanoid](https://forum.serverless.com/u/bubanoid)\
**Post date:** [February 20, 2019, 5:07pm UTC](https://forum.serverless.com/t/pdb-error-while-debug-python-app-with-serverless-launched-offline/7447/1 "2019-02-20T17:07:23Z")

</div>

I have problem with debugging my view function with  
`import pdb; pdb.set_trace()`  
placed inside it and serverless launched as  
`> sls offline start`  
in console.  
Namely, making correspondent GET request I receive the following error:

```
Python: > /.../handler.py(88)get_results()
-> request_params = event.query_params

Python: (Pdb)

Python: 2019-02-20 18:37:43,648 [ERROR] | ...
Traceback (most recent call last):
  ...
  File ".../handler.py", line 88, in get_results
  ...
  File "/usr/lib/python3.6/bdb.py", line 51, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.6/bdb.py", line 70, in dispatch_line
    if self.quitting: raise BdbQuit
bdb.BdbQuit

```

Google suggests that the problem is in the inability of serverless process to read from stdin, but I don’t know how to handle this problem.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![bubanoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bubanoid/32/3062_2.png) [@bubanoid](https://forum.serverless.com/u/bubanoid)\
**Post date:** [February 28, 2019, 9:15am UTC](https://forum.serverless.com/t/pdb-error-while-debug-python-app-with-serverless-launched-offline/7447/2 "2019-02-28T09:15:28Z")

</div>

I found a solution on [stackoveflow](https://stackoverflow.com/a/26975795/4388451):

1. create two fifos:

in one terminal

1. In the same terminal open `stdout` on background, and write to `stdin`:

2. In python code create the the `pdb` object, and use it:

3. Run python script from the folder where fifos were placed (or place fifos in the first step in the folder with python code) in another terminal

Now I am able to use `pdb` in first console!

PS  
It is useful to use `--noTimeout` option while debugging: `sls offline --noTimeout`
