durusmail: quixote-users: scgi_server on Mac OS X
scgi_server on Mac OS X
2005-06-08
2005-06-09
2005-06-09
2005-06-09
2005-06-09
2005-06-09
2005-06-10
scgi_server on Mac OS X
mso@oz.net
2005-06-08
scgi_server.py has an "interesting" case sensitivity problem on Mac OS X
10.3.
Starting the server raises:


DeprecationWarning: the FCNTL module is deprecated; please use fcntl
  DeprecationWarning)
Traceback (most recent call last):
  File "rlink-server.py", line 96, in ?
    if __name__ == "__main__":  main()
  File "rlink-server.py", line 92, in main
    scgi()
  File "rlink-server.py", line 83, in scgi
#### COMMENT: THE NEXT LINE IS A CALL TO scgi_server.run() ####
    script_name=config.scgi_script_name,
max_children=config.scgi_max_children)
  File "/Library/WebServer/rlink/lib/quixote/server/scgi_server.py",  line
47, in run
  File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/scgi/scgi_server.py", line 104, in __init__
    self.spawn_child()
  File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/scgi/scgi_server.py", line 118, in spawn_child
    flags = fcntl.fcntl(child_fd, fcntl.F_GETFL, 0)
AttributeError: 'module' object has no attribute 'fcntl'

But scgi_server isn't doing "import FCNTL"; it's doing "import fcntl".
Doing this from the command line works fine; fcntl.fcntl exists.

What's happening is, the "C" version of fcntl is in a lib-dynload
directory, which is before the lib directory in the Python path.  But due
to the Mac's case insensitivity, "FCNTL.py" is found instead by the
program.  It loads variables from "fcntl.py", a dummy module with only a
few objects.

I don't know why the same problem doesn't happen interactively.  My
workaround is to insert the lib-dynload directory again to the beginning
of the path:
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-
dynload

Once this is solved, the application works fine.

I've heard OS X 10.4 has fixed this, but we're not ready to upgrade yet.

--
-- Mike Orr 

reply