honeybadger-io / honeybadger-python

Send Python and Django errors to Honeybadger.
https://www.honeybadger.io/
MIT License
15 stars 25 forks source link

Error when loading on Windows #36

Closed joshuap closed 4 years ago

joshuap commented 5 years ago

A customer emailed in to say that they are getting an error when loading honeybadger-python under Windows.

Code:

from honeybadger import honeybadger
honeybadger.configure(api_key='62ff4aea')
raise Exception("This will get reported!")

Result:

Traceback (most recent call last):
File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\honeybadger\core.py", line 39, in exception_hook
self._send_notice(value, exc_traceback, context=self._get_context())
File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\honeybadger\core.py", line 22, in _send_notice
payload = create_payload(exception, exc_traceback, config=self.config, context=context)
File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\honeybadger\payload.py", line 102, in create_payload
'server': server_payload(config),
File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\honeybadger\payload.py", line 68, in server_payload
loadavg = os.getloadavg()
AttributeError: module 'os' has no attribute 'getloadavg'
Original exception was:
Traceback (most recent call last):
File "E:\Random Scripts\youtube-search-test.py", line 85, in <module>
raise Exception("This will get reported!")
Exception: This will get reported!
Aulig commented 4 years ago

Im also getting this issue on windows 10 with flask.

from honeybadger.contrib import FlaskHoneybadger

FlaskHoneybadger(app, report_exceptions=True)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Programme\Python38\Lib\site-packages\flask\app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "D:\Programme\Python38\Lib\site-packages\flask\app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "D:\Programme\Python38\Lib\site-packages\flask\app.py", line 1858, in handle_exception
    got_request_exception.send(self, exception=e)
  File "D:\Programme\Python38\Lib\site-packages\blinker\base.py", line 266, in send
    return [(receiver, receiver(sender, **kwargs))
  File "D:\Programme\Python38\Lib\site-packages\blinker\base.py", line 266, in <listcomp>
    return [(receiver, receiver(sender, **kwargs))
  File "D:\Programme\Python38\Lib\site-packages\honeybadger\contrib\flask.py", line 172, in _handle_exception
    honeybadger.notify(exception)
  File "D:\Programme\Python38\Lib\site-packages\honeybadger\core.py", line 52, in notify
    self._send_notice(exception, context=merged_context)
  File "D:\Programme\Python38\Lib\site-packages\honeybadger\core.py", line 22, in _send_notice
    payload = create_payload(exception, exc_traceback, config=self.config, context=context)
  File "D:\Programme\Python38\Lib\site-packages\honeybadger\payload.py", line 102, in create_payload
    'server': server_payload(config),
  File "D:\Programme\Python38\Lib\site-packages\honeybadger\payload.py", line 68, in server_payload
    loadavg = os.getloadavg()
AttributeError: module 'os' has no attribute 'getloadavg'
joshuap commented 4 years ago

Thanks for the traceback, @Aulig. @demsullivan could you look into supporting Windows?

joshuap commented 4 years ago

For future reference, this was released in 0.3.0.