jsii icon indicating copy to clipboard operation
jsii copied to clipboard

Python pdb support?

Open pd5rm opened this issue 5 years ago • 2 comments

It would nice to be able to use built in 'pdb' Python debugger module to inspect/step through generation of template.

Use Case

This would allow us to use native breakpoints, instead of using print-log style debugging.

Proposed Solution

Other

Currently, when I use pdb, it fails with following trace:

(.env) username@sabu:~/git/PROJ-cdk-customer$ cdk diff
> /home/username/git/PROJ-cdk-customer/PROJ_cdk_customer/customer_stack.py(77)addVPNConnections()
-> for count,customer_gateway_id in enumerate(customer_gateway_ids):
(Pdb) 
Traceback (most recent call last):
  File "app.py", line 29, in <module>
    customerStack(app,"customerStack-%s" % region, PROJConfig, env=core.Environment(region=region))
  File "/home/username/git/PROJ-cdk-customer/.env/lib/python3.7/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/home/username/git/PROJ-cdk-customer/PROJ_cdk_customer/customer_stack.py", line 32, in __init__
    self.PROJvpc.addVPNConnections(config.shortname,config.get_resource_for(config.VPN_CUSTOMER_GATEWAY_KEY))
  File "/home/username/git/PROJ-cdk-customer/PROJ_cdk_customer/customer_stack.py", line 77, in addVPNConnections
    for count,customer_gateway_id in enumerate(customer_gateway_ids):
  File "/home/username/git/PROJ-cdk-customer/PROJ_cdk_customer/customer_stack.py", line 77, in addVPNConnections
    for count,customer_gateway_id in enumerate(customer_gateway_ids):
  File "/usr/lib/python3.7/bdb.py", line 88, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.7/bdb.py", line 113, in dispatch_line
    if self.quitting: raise BdbQuit

I think this results from CDK trying to dump stuff to stdout and pdb expecting to handle user input from stdin.

  • [ ] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request

pd5rm avatar Oct 29 '19 21:10 pd5rm