Hm. len(sys.argv) ? This is coming from the script that turbogears
generated? The one you're supposed to run as a standalone server?
The script generated for me doesn't have any reference to sys.argv.
Here it is, posted below:
--
#!/usr/bin/env python
import pkg_resources
pkg_resources.require("TurboGears")
import cherrypy
from os.path import *
#look for setup.py in this directory. If it's not there, this script is
#probably installed
if exists(join(dirname(__file__), "setup.py")):
cherrypy.config.update(file="/home/leo/public_html/tg/dev.cfg")
else:
cherrypy.config.update(file="/home/leo/public_html/tg/prod.cfg")
from tg.controllers import Root
cherrypy.root = Root()
if __name__ == "__main__":
cherrypy.server.start()
def mp_setup():
pass
--
Also, I'm thinking your $PYTHONPATH might be screwed up like mine. I'm
guessing you didn't install TurboGears into site-packages, so there's a
chance that the mod_python $PYTHONPATH isn't seeing it.
If this is true, I have no idea how to fix it (thus the mpcp.py in my
turbo gears directory). Maybe put PYTHONPATH in /etc/profile? Oh!
Also, you're /supposed/ to be able to do this, but I wasn't able to get
it working. In your .htaccess
PythonPath "sys.path+['/path/to/turbogears']"
Ref:
http://www.cherrypy.org/wiki/CherrypyInModPython
Note, the above link follows a different approach to integration. I
couldn't get that working, but I have the IQ of fruit.