When I execute python script, this problem occurs:
'import site' failed; use -v for tracebackso I tried again with -v option, and I can get these messages:
'import site' failed; traceback:
Traceback (most recent call last): File "/usr/lib/python2.6/site.py", line 513, in <module> main() File "/usr/lib/python2.6/site.py", line 495, in main known_paths = addusersitepackages(known_paths) File "/usr/lib/python2.6/site.py", line 238, in addusersitepackages USER_BASE = env_base if env_base else joinuser("~", ".local") File "/usr/lib/python2.6/site.py", line 225, in joinuser return os.path.expanduser(os.path.join(*args)) File "/usr/lib/python2.6/posixpath.py", line 256, in expanduser userhome = pwd.getpwuid(os.getuid()).pw_dir
KeyError: 'getpwuid(): uid not found: 65530'How can I deal with this situations?
13 Answers
Looks like it expects a user with id 65530 to exist on your system, but it doesn't. And it gets that id by calling os.getuid() which returns the current user id.
Perhaps the user you're running this as has been deleted or disabled in the meantime? Check /etc/passwd for clues.
Update in light of your comment: apparently /etc/passwd does not exist inside your chroot jail. Either you can try mapping it in, or you can set the HOME environment variable to something sensible, as the code for expanduser says:
if 'HOME' not in os.environ: import pwd userhome = pwd.getpwuid(os.getuid()).pw_dir else: userhome = os.environ['HOME'] 3 I too faced this issue. Little bit searching on the net, i got the fix. Check your environment variable PYTHONHOME.
Try to unset the PYTHONHOME and try. It worked for me.
(Ref: )
If you get this ERROR from mod_wsgi on apache (in you app error log), the FIX is to add "home=/path/to/app" to your WSGIDaemonProcess directive in your wsgi.conf (it doesn't matter that much where you set the path to). For example--
WSGIDaemonProcess ckan_default display-name=ckan_default processes=2 threads=15 home=/usr/lib/ckan/default 1