alexmojaki / alexmojaki/heartrate

AttributeError: 'Call' object has no attribute 'first_token'

Aperta
#11 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
1.8k
Fork
121
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

On a fresh install of python 3.10 and heartrate, [the following code](https://github.com/ProsperousHeart/My-Projects/blob/main/PlayCode/heartrate_test.py):

```python
from time import sleep
import heartrate
heartrate.trace(browser=True)

def factorial(x):
if x == 1:
return 1
else:
sleep(0.5)
return (x * factorial(x-1))

if __name__ == "__main__":
while True:
try:
num = int(input("What number >= 0 would you like to see a factorial of?\t"))
except ValueError as err:
print("Please provide an integer >= 0.")
else:
if num <= 0:
print("Please provide an integer greater than 0.")
else:
break
print(f"The factorial of {num} is {factorial(num)}")
```

.... never ends the program!

![image](https://user-images.githubusercontent.com/20706498/155869366-e137efb7-40d3-4130-8c5d-109178fb38ca.png)

Here is the error message that happens:

```
[2022-02-26 22:30:47,754] ERROR in app: Exception on /stacktrace/ [GET]
Traceback (most recent call last):
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\heartrate\core.py", line 181, in stacktrace
list(gen())[::-1]
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\heartrate\core.py", line 172, in gen
highlight_stack_frame(frame),
File "C:\Users\Kat\.virtualenvs\My-Projects\lib\site-packages\heartrate\core.py", line 55, in highlight_stack_frame
start = node.first_token.start[0]
AttributeError: 'Call' object has no attribute 'first_token'
```

What am I missing here?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.