django-pdb icon indicating copy to clipboard operation
django-pdb copied to clipboard

Make it to serve Python 3.6--currently not solving

Open ghost opened this issue 7 years ago • 4 comments

Hi Mitch,

maybe when you have time pls update this source code to be compatible with python 3 and the rest of them etc. Currently not working :( and it sucks cos it gaves a lot of errors.

ghost avatar Feb 08 '18 20:02 ghost

Hi there @iocohen,

I ll take a look at this issue this weekend. Also, I'm planning to rewrite the whole project, also dropping support to older django versions and python 2 (freezing them on another branch so they're accessible), so any other suggestions are more than welcome.

Thanks!

HassenPy avatar Feb 09 '18 13:02 HassenPy

hey @iocohen, can you please add any traceback to the errors you're getting?

HassenPy avatar Mar 01 '18 15:03 HassenPy

I'm also having issues with it in py3.6, w/ Django 1.11.13, here's a traceback:

Traceback (most recent call last):            
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner                                                               
    response = get_response(request)          
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__                                                                 
    response = self.get_response(request)     
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner                                                               
    response = response_for_exception(request, exc)                                          
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py", line 83, in response_for_exception                                              
    response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)       
TypeError: runpdb() got an unexpected keyword argument 'status_code'                         
Exception occured: <class 'TypeError'>, runpdb() got an unexpected keyword argument 'status_code'                                                                                         
> /home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py(83)response_for_exception()                                                             
     82         if settings.DEBUG:            
---> 83             response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)                                                                                    
     84         else:  

Looks like the method you're replacing w/ runpdb allows for a status_code kwarg: https://github.com/django/django/blob/e8531cc89c878b6a8867498dab266917fef2bff4/django/views/debug.py#L84

jfw avatar Jun 11 '18 01:06 jfw

As @jfw told, the error @jfw met seems to be caused when unexpected status_code is passed to runpdb.

https://github.com/HassenPy/django-pdb/blob/8f57b2c722f05d33a4cb6594115659e08173b89f/django_pdb/init.py#L10-L19

The replaced function technical_500_response in Django core was changed in the following commit:

https://github.com/django/django/commit/dbbcfca476e29354c3a5c6221112b55741babc14#diff-0c275b0ae46e69a41401fe13da9b1b39L68

Changing the runpdb should solve the issue.

gh640 avatar Jun 12 '18 06:06 gh640