Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType' #2596

Closed
elicwhite opened this issue Aug 4, 2016 · 7 comments
Closed

Comments

@elicwhite
Copy link
Contributor

Looks like when the bot is starting up, these fields aren't populated so we get None back. We should return 0 if either of these are None

https://app.getsentry.com/pokemongof/pokemongo-bot/issues/147416492/

TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
  File "pokecli.py", line 490, in <module>
    main()
  File "pokecli.py", line 95, in main
    report_summary(bot)
  File "pokecli.py", line 136, in report_summary
    logger.info('Total XP Earned: {}  Average: {:.2f}/h'.format(metrics.xp_earned(), metrics.xp_per_hour()))
  File "pokemongo_bot/metrics.py", line 28, in xp_earned
    return self.xp['latest'] - self.xp['start']

TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
@mooseknuckleking
Copy link

mooseknuckleking commented Aug 7, 2016

I am having this issue. How to we alter the pokecly.py files so that I no longer get this error?

016-08-07 10:19:24,084 [PokemonGoBot] [INFO]
2016-08-07 10:19:24,084 [PokemonGoBot] [INFO]
2016-08-07 10:19:31,577 [ cli] [INFO]
2016-08-07 10:19:31,577 [ cli] [INFO] Ran for 0:00:11
Traceback (most recent call last):
File "pokecli.py", line 493, in
main()
File "pokecli.py", line 127, in main
report_summary(bot)
File "pokecli.py", line 139, in report_summary
logger.info('Total XP Earned: {} Average: {:.2f}/h'.format(metrics.xp_earned(), metrics.xp_per_hour()))
File "/Users/trevor/PokemonGo-Bot/pokemongo_bot/metrics.py", line 28, in xp_earned
return self.xp['latest'] - self.xp['start']
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

@elicwhite
Copy link
Contributor Author

This is still a problem.

@elicwhite elicwhite reopened this Aug 7, 2016
@johannlejeune
Copy link
Contributor

Looks like this happens on first login with a fresh new account.
UpdateLiveStats tries to get the XP to display the stats and fails at it.
Temporary fix I found is :

  • Disabling the worker
  • Running the bot once, let it catch a Pokemon, spin a Pokestop, do stuff
  • Re-enable the worker
  • Watch it work 👍

@smfbrooks
Copy link

Can we make this fix?

@MasterCATZ
Copy link

yes this is what needs to be done

but it's not a fix

account just needs to be level 1 before livestats can be enabled

@johannlejeune
Copy link
Contributor

@MasterCATZ Yes, it's not a fix. If being level 1 is enough to make it work, we could add a level check in update_live_stats._should_display to avoid fetching stats when we're not level 1.

@smfbrooks
Copy link

#4088

@k4n30 k4n30 closed this as completed Aug 17, 2016
hoanghuynh pushed a commit to hoanghuynh/PokemonGo-Bot that referenced this issue Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants