Andi Vajda <[email protected]> wrote:
>
> On Thu, 8 Dec 2011, Bill Janssen wrote:
>
> > Andi Vajda <[email protected]> wrote:
> >
> >> It seems that adding, before if __name__ == '__main__':
> >> from jcc import _jcc
> >>
> >> works just fine on 2.7 and 2.6 as well.
> >
> > Yes, this works on 2.5, as well.
> >
> >> Speaking of which, I don't see when __name__ would be == '__main__'. I
> >> tried
> >> various combinations with pdb and __name__ is always == 'jcc'.
> >>
> >> If that makes sense to you as well, I can change that block to just say:
> >> from _jcc import initVM
> >
> > I put a print statement in... When you invoke it with Python 2.5 as
> > "python -m jcc", __name__ is "__main__". That's what runs the code,
> > so I don't think you can remove it.
>
> Ah ha. All right, then this change should work:
>
> ...
> # used when jcc is invoked with -m from python 2.5
> if __name__ == '__main__':
> import jcc.__main__
>
> from jcc import _jcc
> from _jcc import initVM
> ...
>
> Andi..
Nope. Here's what I get when I try it:
[...]
creating build/lib.macosx-10.5-i386-2.5
creating build/lib.macosx-10.5-i386-2.5/lucene
g++ -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc
build/temp.macosx-10.5-i386-2.5/build/_lucene/__init__.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/__wrap01__.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/__wrap02__.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/__wrap03__.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/__wrap04__.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/__wrap05__.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/functions.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/JArray.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/JObject.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/lucene.o
build/temp.macosx-10.5-i386-2.5/build/_lucene/types.o
-L/Library/Python/2.5/site-packages/JCC-2.12-py2.5-macosx-10.5-i386.egg -ljcc
-o build/lib.macosx-10.5-i386-2.5/lucene/_lucene.so -framework JavaVM -Wl,-S
-Wl,-rpath /Library/Python/2.5/site-packages/JCC-2.12-py2.5-macosx-10.5-i386.egg
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/runpy.py",
line 95, in run_module
filename, loader, alter_sys)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/runpy.py",
line 52, in _run_module_code
mod_name, mod_fname, mod_loader)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/runpy.py",
line 32, in _run_code
exec code in run_globals
File
"/Library/Python/2.5/site-packages/JCC-2.12-py2.5-macosx-10.5-i386.egg/jcc/__init__.py",
line 36, in <module>
from _jcc import initVM
ImportError: No module named _jcc
make: *** [compile] Error 255
/tmp/pylucene-3.5.0-2 1142 % cat
/Library/Python/2.5/site-packages/JCC-2.12-py2.5-macosx-10.5-i386.egg/jcc/__init__.py
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# jcc package
import os, sys
if sys.platform == 'win32':
if '--find-jvm-dll' in sys.argv:
from windows import add_jvm_dll_directory_to_path
add_jvm_dll_directory_to_path()
from jcc.config import SHARED
if SHARED:
path = os.environ['Path'].split(os.pathsep)
eggpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
if eggpath not in path:
path.insert(0, eggpath)
os.environ['Path'] = os.pathsep.join(path)
# used when jcc is invoked with -m from python 2.5
if __name__ == '__main__':
import jcc.__main__
from jcc import _jcc
from _jcc import initVM
CLASSPATH=os.path.join(os.path.abspath(os.path.dirname(__file__)), "classes")
_jcc.CLASSPATH = CLASSPATH
/tmp/pylucene-3.5.0-2 1143 %