Mon 19 Oct 2009

Fix to avoid sh: cc: not found while loading Python's uuid module

uuid uses ctypes.util.find_library to find libuuid and libc.

find_library calls out to cc/gcc to do its work.

This produces an annoying sh: cc: not found message at runtime when you don't have a damn compiler on your production box. Here's the diff against uuid.py.

402c402,406
<             lib = ctypes.CDLL(ctypes.util.find_library(libname))
---
>             # Attempt static first.
>             path = {'uuid': '/usr/lib/libuuid.so',
>                     'c':    '/usr/lib/libc.so'}.get(libname) or 
>                    ctypes.util.find_library(libname)
>             lib = ctypes.CDLL(path)

Posted at 2009-10-19 14:10:00 by Richard NewmanLink to Fix to avoid sh: c…