unsupported operand types for //: 'str', 'int'

RaviKiran

I have found this function to format the exception that raised

def format_trace_except(self, sysexecinfo, smessage= ''):
   """ Trace exceptions """
   exc_type, exc_value, exc_traceback = sysexecinfo
   i, j = (traceback.extract_tb(exc_traceback, 1))[0][0:2]
   k = (traceback.format_exception_only(exc_type, exc_value))[0]
   trace('Err : ' + smessage + k + i + ', line ' + str(j))
   return k

when I am using this function I am getting the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 121, in get_response
    response = middleware_method(request, e)
  File "/home/xxxxxxxxxxxxx", line 60, in process_exception
    return self.handle_500(request, exception)
  File "/home/xxxxxxxxxxxxxxx", line 64, in handle_500
    response = self.format_trace_except(sys.exc_info())
  File "/home/xxxxxxxxxxxxxxxxx", line 74, in format_trace_except
    x = trace('Err : ' + smessage + k + i + ', line ' + str(j))
  File "/usr/lib/python2.7/inspect.py", line 1058, in trace
    return getinnerframes(sys.exc_info()[2], context)
  File "/usr/lib/python2.7/inspect.py", line 1043, in getinnerframes
    framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
  File "/usr/lib/python2.7/inspect.py", line 1005, in getframeinfo
    start = lineno - 1 - context//2
TypeError: unsupported operand type(s) for //: 'str' and 'int'

Can anyone tell me how to fix it?

Ignacio Vazquez-Abrams

Stop importing * from inspect.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Unsupported operand type(s) for +: 'int' and 'str'

From Dev

TypeError: unsupported operand type(s) for -: 'str' and 'int' Writing a story?

From Dev

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

From Dev

TypeError: unsupported operand type(s) for |: 'int' and 'str'

From Dev

Sum function prob TypeError: unsupported operand type(s) for +: 'int' and 'str'

From Dev

unsupported operand types for * : 'float' and 'decimal'

From Dev

Python re.compile: unsupported operand type(s) for &: str and int

From Dev

TypeError: unsupported operand type(s) for +=: 'int' and 'list'

From Dev

Unsupported operand type(s) for +: 'float' and 'str' error

From Dev

Python - Unsupported Operand Type(s) for -: 'int' and 'str'

From Dev

TypeError: unsupported operand type(s) for -: 'str' and 'int' Python

From Dev

TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'

From Dev

Unsupported operand types 'NoneType'

From Dev

Django unsupported operand types

From Dev

TypeError: unsupported operand type(s) for +: 'Tag' and 'str'

From Dev

python error; unsupported operand type(s) for +: 'int' and 'str'

From Dev

getting error unsupported operand type(s) for +: 'int' and 'str'

From Dev

TypeError: unsupported operand type(s) for +: 'int' and 'str' value

From Dev

Unsupported operand type(s) for +: 'NoneType' and 'str' and 'int'

From Dev

Printing highest average - "unsupported operand type(s) for +: 'int' and 'str'"

From Dev

averages of numbers in lines of data file "unsupported operand type(s) for +: 'int' and 'str'"

From Dev

TypeError: unsupported operand type(s) for +=: 'int' and 'str'

From Dev

TypeError: unsupported operand type(s) for div: 'str' and 'int' [line 14]

From Dev

Python 3 TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'

From Dev

Python27 TypeError: unsupported operand for type(s) += 'int' and 'str'

From Dev

TypeError: unsupported operand type(s) for /: 'int' and 'str' when making grid

From Dev

unsupported operand type(s) for /: 'str' and 'int' but different

From Dev

Unsupported operand types for bitwise exclusive OR in Python

From Dev

unsupported operand type(s) for +=: 'int' and 'str' on pycharm

Related Related

  1. 1

    Unsupported operand type(s) for +: 'int' and 'str'

  2. 2

    TypeError: unsupported operand type(s) for -: 'str' and 'int' Writing a story?

  3. 3

    TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

  4. 4

    TypeError: unsupported operand type(s) for |: 'int' and 'str'

  5. 5

    Sum function prob TypeError: unsupported operand type(s) for +: 'int' and 'str'

  6. 6

    unsupported operand types for * : 'float' and 'decimal'

  7. 7

    Python re.compile: unsupported operand type(s) for &: str and int

  8. 8

    TypeError: unsupported operand type(s) for +=: 'int' and 'list'

  9. 9

    Unsupported operand type(s) for +: 'float' and 'str' error

  10. 10

    Python - Unsupported Operand Type(s) for -: 'int' and 'str'

  11. 11

    TypeError: unsupported operand type(s) for -: 'str' and 'int' Python

  12. 12

    TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'

  13. 13

    Unsupported operand types 'NoneType'

  14. 14

    Django unsupported operand types

  15. 15

    TypeError: unsupported operand type(s) for +: 'Tag' and 'str'

  16. 16

    python error; unsupported operand type(s) for +: 'int' and 'str'

  17. 17

    getting error unsupported operand type(s) for +: 'int' and 'str'

  18. 18

    TypeError: unsupported operand type(s) for +: 'int' and 'str' value

  19. 19

    Unsupported operand type(s) for +: 'NoneType' and 'str' and 'int'

  20. 20

    Printing highest average - "unsupported operand type(s) for +: 'int' and 'str'"

  21. 21

    averages of numbers in lines of data file "unsupported operand type(s) for +: 'int' and 'str'"

  22. 22

    TypeError: unsupported operand type(s) for +=: 'int' and 'str'

  23. 23

    TypeError: unsupported operand type(s) for div: 'str' and 'int' [line 14]

  24. 24

    Python 3 TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'

  25. 25

    Python27 TypeError: unsupported operand for type(s) += 'int' and 'str'

  26. 26

    TypeError: unsupported operand type(s) for /: 'int' and 'str' when making grid

  27. 27

    unsupported operand type(s) for /: 'str' and 'int' but different

  28. 28

    Unsupported operand types for bitwise exclusive OR in Python

  29. 29

    unsupported operand type(s) for +=: 'int' and 'str' on pycharm

HotTag

Archive