1

I have this error on a dreamhost shared server with a custom installation of python. I used this tutorial for the installation months ago:

after the update of the servers of dreamhost (to ubuntu 12.04) this weekend, this error showed up:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 337, in _init_posix
    makefile = _get_makefile_filename()
  File "/usr/lib/python2.7/sysconfig.py", line 331, in _get_makefile_filename
    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
AttributeError: 'module' object has no attribute 'pydebug'

I try these things and did not work:

  • Reinstall custom python
  • Change PYTHONPATH
  • Create a new user in dreamhost for a fresh start
  • Install virtualenv without custom python.

I think the problem is the path of python, but i dont know how change it.

EDIT 1: I tried install custom python with --with-pydebug on ./configure command. Did not work.

1 Answers1

1

Just put in the file passenger_wsgi.py these lines

INTERP = cwd + "/env/bin/python"
if sys.executable != INTERP: 
    os.execl(INTERP, INTERP, *sys.argv)

instead of

#Switch to new python
if sys.version < "2.7.7": os.execl(cwd+"/env/bin/python", "python2.7", *sys.argv)

This forces passenger_wsgi.py to use the python interpreter installed in the virtualenv.