1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python Error collecting try..except info from source

Discussão em 'Python' iniciado por Stack, Abril 5, 2025.

  1. Stack

    Stack Membro Participativo

    What type of Python error is this, and what causes it? The output with the error is below:

    Total Vehicles: 4321
    Total Closings: 9
    3.05s - Error collecting try..except info from source (C:\Users\micsl\source\repos\Midterm02\Bridge Monitor\mainPackage\main.py)
    Traceback (most recent call last):
    File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\pydevd.py", line 737, in collect_try_except_info
    if line > max_line:
    ^^^^^^^^^^^^^^^
    TypeError: '>' not supported between instances of 'NoneType' and 'int' **


    Below is my main.py:


    from bridgePackage.bridge import *

    if __name__ == "__main__":
    close_count = 0
    total_count = 0

    start_count = BridgeMonitor()
    for i in range(100):
    try:
    vehicle_count = start_count.getVehicleCount()
    except Exception as e:
    pass
    close_count += 1
    else:
    total_count += vehicle_count

    print("Total Vehicles: ", total_count)
    print("Total Closings: ", close_count)


    bridge.py:

    import random


    class BridgeMonitor():
    def __init__(self):
    pass

    def getVehicleCount(self):
    if random.randint(100, 200) % 10 == 0:
    raise Exception("Bridge is closed")
    return random.randint(0, 100)

    Continue reading...

Compartilhe esta Página