> It's not sys.path (that's where PYTHONPATH ends up), it's the env's PATH or,
> more precisely, the process's executable search path that needs to be
> updated. I don't know of a linker way to do this on Windows. Once the
> process has started, my understanding is that it's too late already.
Right. On Windows, though, this works:
Index: jcc/jcc/__init__.py
===================================================================
--- jcc/jcc/__init__.py (revision 405)
+++ jcc/jcc/__init__.py (working copy)
@@ -22,8 +22,24 @@
# jcc package
+import sys
+if sys.platform == 'win32':
+
+ # figure out where the jvm.dll is, and make sure that location is on PATH
+ import _winreg as wreg
+ registry = wreg.ConnectRegistry(None, wreg.HKEY_LOCAL_MACHINE)
+ key = wreg.OpenKey(registry, r"SOFTWARE\JavaSoft\Java Runtime Environment")
+ v, t = wreg.QueryValueEx(key, "CurrentVersion")
+ key = wreg.OpenKey(registry, r"SOFTWARE\JavaSoft\Java Runtime
Environment\%s" % v)
+ javahome, t = wreg.QueryValueEx(key, "JavaHome")
+ registry.Close()
+ # if we have a javahome, make sure it's on the PATH
+ if javahome:
+ import os
+ location = os.path.join(javahome, "bin", "client")
+ os.environ['Path'] = ';'.join(os.environ['Path'].split(';') +
[location,])
+
if __name__ == '__main__':
- import sys
from jcc import cpp
cpp.jcc(sys.argv)
else:
The downside is that you have to add this kind of little startup blit
to each JCC-wrapped module. So, this either needs to be turned into
a JCC utility function which gets called once per Python instantiation,
or generated by the wrapper generation process for each module.
Bill
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev