mihalis's picture

ImportError: cannot import name _remove_dead_weakref

While trying to renew some of the Let's Encrypt certs, I got the following error:

$ ./letsencrypt-auto renew
Error: couldn't get currently installed version for /opt/
Traceback (most recent call last):
File "/opt/", line 7, in
from certbot.main import main
File "/opt/", line 6, in
import logging.handlers
File "/usr/lib/python2.7/logging/", line 26, in
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
File "/usr/lib/python2.7/", line 14, in
from _weakref import (
ImportError: cannot import name _remove_dead_weakref

The solution was to execute the following command:

$ mv /opt/ /tmp

The /opt/ directory will be recreated.

mihalis's picture

Uncaught Error: Call to undefined function cache_get() in

If you get:

# drush up
PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in ...

The solution might be as simple as executing the next command:
# sudo ln -sfn /usr/bin/php5 /etc/alternatives/php

Drupal 7

mihalis's picture

10 ways to use the UNIX find command

  1. Finding a single file
  2. $ find /etc/ -name httpd.conf

  3. Finding directories only
  4. find . –type d –name code

  5. Listing zero sized files and directories
  6. $ find ~ -empty -exec ls {} \;

  7. Finding all the files of a given user
  8. $ find . -user www

  9. Finding files within a size range
  10. The following command finds files that are bigger than 100Mbytes:
    $ find . –size +100M

  11. Finding files using date parameters
  12. The following command finds files that are older than 15 days:
    $ find . –mtime +15

  13. • The following command files all the files named “Makefile” and loads all of them in the vi editor:
  14. $ vi `find . -name Makefile`

  15. Defining the directory depth of the search
  16. $ find . -maxdepth 3

  17. The find command also supports logical expressions
  18. The following command finds the files that end in either “.m” or “.c”:
    $ find . \( -name "*.c" -o -name "*.m" \)

  19. • The following command finds all the files in the current folder and its subfolders that are owned neither by user “mtsouk” nor by user “www”:
  20. $ find . ! \( -user www -o -user mtsouk \) -exec ls –l {} \;

Subscribe to RSS - tips