Qix- / better-exceptions

Pretty and useful exceptions in Python, automatically.
MIT License
4.6k stars 204 forks source link

better_exceptions_hook.pth is missing from the package #52

Closed vmarkovtsev closed 6 years ago

vmarkovtsev commented 6 years ago

Here is what I do on Ubuntu with python 3.5:

$ export BETTER_EXCEPTIONS=1
$ sudo apt remove python3-apport
# ...
$ python3 -c "import sys; print(sys.excepthook)"
<built-in function excepthook>
$ sudo pip3 install better_exceptions
Collecting better_exceptions
  Downloading better_exceptions-0.1.8.tar.gz
Installing collected packages: better-exceptions
  Running setup.py install for better-exceptions ... done
Successfully installed better-exceptions-0.1.8
$ python3 -c "import sys; print(sys.excepthook)"
<built-in function excepthook>
$ sudo pip3 uninstall better_exceptions
Uninstalling better-exceptions-0.1.8:
  /usr/local/lib/python3.5/dist-packages/better_exceptions-0.1.8-py3.5.egg-info
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__init__.py
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__main__.py
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__pycache__/__init__.cpython-35.pyc
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__pycache__/__main__.cpython-35.pyc
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__pycache__/color.cpython-35.pyc
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__pycache__/log.cpython-35.pyc
  /usr/local/lib/python3.5/dist-packages/better_exceptions/__pycache__/repl.cpython-35.pyc
  /usr/local/lib/python3.5/dist-packages/better_exceptions/color.py
  /usr/local/lib/python3.5/dist-packages/better_exceptions/log.py
  /usr/local/lib/python3.5/dist-packages/better_exceptions/repl.py
Proceed (y/n)? n

So the hook does not work. The file which README mentions, better_exceptions_hook.pth, does not exist. I have manually copied it from GitHub to /usr/local/lib/python3.5/dist-packages/better_exceptions_hook.pth and got this bizarre error:

$ python3 -c "import sys; print(sys.excepthook)"
An error occured while automatically hooking better_exceptions.
If you uninstalled better_exceptions, you should probably delete any 'better_exceptions_hook.pth' file on your system or unset your 'BETTER_EXCEPTIONS' environment variable.
Error processing line 1 of /usr/local/lib/python3.5/dist-packages/better_exceptions_hook.pth:

  Traceback (most recent call last):
    File "/usr/lib/python3.5/site.py", line 173, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<string>", line 2, in <module>
  AttributeError: module 'better_exceptions' has no attribute 'hook'

Remainder of file ignored
<function excepthook at 0x7f6c4fe9b378>
leemengtw commented 6 years ago

Facing exactly the same problem here. I'm using python:3.6.4 on MAC.

Delgan commented 6 years ago

Hey @vmarkovtsev and @leemengtaiwan.

The problem is that the README you are looking at does not correspond to the pip version you installed. This file (and the rest of the code) has been changed in recent months, but the version you downloaded via pip has not been updated to reflect these changes. There have been 10 commits since version 0.1.8 which are public on the master branch but have not been published on pip.

The corresponding repository state of your version is: 8b020dd You can see that there is no mention of better_exceptions_hook.pth, the hook is automatically activated when you do import better_exceptions.

If you want to install the version corresponding to the master branch you see here, you can use pip install git+https://github.com/Qix-/better-exceptions.

@Qix- has been quite busy with his work lately, that is why updates has not been published to pip.

Qix- commented 6 years ago

I released 0.2.1 that should have included this. Sorry for the delay here 🙏

Preemptively closing. Let me know if upgrading worked!

Thanks again to @Delgan for all of the hard work!