Search code examples
pythondjangodjango-tables2

error uninstalling django-tables2


Recently i installed the library django-tables2 using pip in win 10. Now when i try to uninstall using the command pip uninstall django-tables2 i get an error that's seems to be in python libraries. Here is the stack trace i'm getting:

Exception:
Traceback (most recent call last):
File "c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
packages\pip\_internal\basecommand.py", line 228, in main
status = self.run(options, args)
File "c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
packages\pip\_internal\commands\uninstall.py", line 68, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
packages\pip\_internal\req\req_install.py", line 660, in uninstall
uninstalled_pathset = UninstallPathSet.from_dist(dist)
File "c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
packages\pip\_internal\req\req_uninstall.py", line 316, in from_dist
paths_to_remove.add(path)
File "c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
packages\pip\_internal\req\req_uninstall.py", line 169, in add
if not os.path.exists(path):
File 
"c:\users\usuario\appdata\local\programs\python\python35\lib\genericpath.py", 
line 19, in exists
os.stat(path)
ValueError: stat: embedded null character

Solution

  • Seems that somewhere in the things installed a different encoding to the an actual file encoding is assumed.

    You can always remove the appropriate directory in the site-packages path shown in your error message. You must delete two directories:

    $ pip uninstall django-tables2
    Uninstalling django-tables2-1.21.2:
      Would remove:
        /Users/jieter/.virtualenvs/proj/lib/python3.6/site-packages/django_tables2-1.21.2.dist-info/*
        /Users/jieter/.virtualenvs/proj/lib/python3.6/site-packages/django_tables2/*
    Proceed (y/n)? 
    

    Of course, in your case, the path will be different, more like:

    c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
    packages\django-tables2\
    c:\users\usuario\appdata\local\programs\python\python35\lib\site- 
    packages\django-tables2-<version>.dist-info\