You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Bill Janssen <ja...@parc.com> on 2009/11/18 18:26:23 UTC

building 2.4.1 on Linux (Ubuntu 9)

I'm getting an odd error on Ubuntu 9, Python 2.6.4, Sun Java 6, and
PyLucene 2.4.1, setuptools with patch.43 applied.  Almost at the end,
and I get this:

/usr/bin/python -m jcc --shared --jar lucene-java-2.4.1/build/lucene-core-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/snowball/lucene-snowball-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/highlighter/lucene-highlighter-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/analyzers/lucene-analyzers-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/regex/lucene-regex-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/queries/lucene-queries-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/instantiated/lucene-instantiated-2.4.1.jar --jar build/jar/extensions.jar --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.text.SimpleDateFormat --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream --exclude org.apache.lucene.queryParser.Token --exclude org.apache.lucene.queryParser.TokenMgrError --exclude org.apache.lucene.queryParser.QueryParserTokenManager --exclude org.apache.lucene.queryParser.ParseException --
 python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --sequence org.apache.lucene.search.Hits 'length:()I' 'doc:(I)Lorg/apache/lucene/document/Document;' --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer --version 2.4.1 --module python/collections.py --files 2 --build 
/usr/bin/python: jcc is a package and cannot be directly executed
make: *** [compile] Error 1
% /usr/bin/python -m jcc
/usr/bin/python: jcc is a package and cannot be directly executed
%

What am I doing wrong?

Bill


Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Andi Vajda <va...@apache.org>.
On Wed, 18 Nov 2009, Bill Janssen wrote:

> I'm getting an odd error on Ubuntu 9, Python 2.6.4, Sun Java 6, and
> PyLucene 2.4.1, setuptools with patch.43 applied.  Almost at the end,
> and I get this:
>
> /usr/bin/python -m jcc --shared --jar lucene-java-2.4.1/build/lucene-core-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/snowball/lucene-snowball-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/highlighter/lucene-highlighter-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/analyzers/lucene-analyzers-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/regex/lucene-regex-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/queries/lucene-queries-2.4.1.jar --jar lucene-java-2.4.1/build/contrib/instantiated/lucene-instantiated-2.4.1.jar --jar build/jar/extensions.jar --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.text.SimpleDateFormat --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream --exclude org.apache.lucene.queryParser.Token --exclude org.apache.lucene.queryParser.TokenMgrError --exclude org.apache.lucene.queryParser.QueryParserTokenManager --exclude org.apache.lucene.queryParser.ParseException 
 --
> python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --sequence org.apache.lucene.search.Hits 'length:()I' 'doc:(I)Lorg/apache/lucene/document/Document;' --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer --version 2.4.1 --module python/collections.py --files 2 --build
> /usr/bin/python: jcc is a package and cannot be directly executed
> make: *** [compile] Error 1
> % /usr/bin/python -m jcc
> /usr/bin/python: jcc is a package and cannot be directly executed
> %
>
> What am I doing wrong?

You're being tripped up by Python 2.6 having fixed a 'bug' with -m that 
allowed it to execute packages before.
That functionality was put back as a new feature in Python 2.7.

Until then, you must do as is done in PyLucene's Makefile:

   python -m jcc.__main__

Andi..

Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Bill Janssen <ja...@parc.com>.
Thanks.

Bill

Christian Heimes <li...@cheimes.de> wrote:

> Bill Janssen wrote:
> > /usr/bin/python: jcc is a package and cannot be directly executed
> > make: *** [compile] Error 1
> > % /usr/bin/python -m jcc
> > /usr/bin/python: jcc is a package and cannot be directly executed
> > %
> > 
> > What am I doing wrong?
> 
> 
> Python 2.6 doesn't support packages as target of -m. JCC has already a
> workaround that works on Python 2.5 and 2.6: "-m jcc.__main__".
> 
> Christian

Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Andi Vajda <va...@apache.org>.
On Nov 19, 2009, at 2:15, Andrew MacKinlay <ad...@gmail.com> wrote:

>
> On 18/11/2009, at 9:38 PM, Andi Vajda wrote:
>
>>
>> On Wed, 18 Nov 2009, Andrew MacKinlay wrote:
>>
>>> Surely this is enough of a gotcha (got bitten by it myself), that  
>>> it could be mentioned on the documentation page? (And likely to  
>>> get more frequent I imagine, as python 2.6 uptake increases which  
>>> we might expect in the short term).
>>
>> It's stated in the Makefile. When you go uncomment the section in  
>> the Makefile that corresponds to your situation you should be  
>> picking one of the ones for Python 2.6.
>>
>
> Yep, but for people running JCC in standalone mode to wrap other  
> java libraries, the pylucene Makefile might not be the first place  
> they'll go for documentation... It's not mentioned on the JCC docs  
> page.

Ah yes, that is correct. I see your point now. I should add an  
'invoking jcc' section to the docs (or update it if there is already  
one) to that effect.

Thanks !

Andi..

>
> Andy

Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Andrew MacKinlay <ad...@gmail.com>.
On 18/11/2009, at 9:38 PM, Andi Vajda wrote:

>
> On Wed, 18 Nov 2009, Andrew MacKinlay wrote:
>
>> Surely this is enough of a gotcha (got bitten by it myself), that  
>> it could be mentioned on the documentation page? (And likely to get  
>> more frequent I imagine, as python 2.6 uptake increases which we  
>> might expect in the short term).
>
> It's stated in the Makefile. When you go uncomment the section in  
> the Makefile that corresponds to your situation you should be  
> picking one of the ones for Python 2.6.
>

Yep, but for people running JCC in standalone mode to wrap other java  
libraries, the pylucene Makefile might not be the first place they'll  
go for documentation... It's not mentioned on the JCC docs page.

Andy

Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Andi Vajda <va...@apache.org>.
On Wed, 18 Nov 2009, Andrew MacKinlay wrote:

> Surely this is enough of a gotcha (got bitten by it myself), that it could be 
> mentioned on the documentation page? (And likely to get more frequent I 
> imagine, as python 2.6 uptake increases which we might expect in the short 
> term).

It's stated in the Makefile. When you go uncomment the section in the 
Makefile that corresponds to your situation you should be picking one of the 
ones for Python 2.6.

Andi..

Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Andrew MacKinlay <ad...@gmail.com>.
Surely this is enough of a gotcha (got bitten by it myself), that it  
could be mentioned on the documentation page? (And likely to get more  
frequent I imagine, as python 2.6 uptake increases which we might  
expect in the short term).

Andy


On 18/11/2009, at 5:29 PM, Christian Heimes wrote:

> Bill Janssen wrote:
>> /usr/bin/python: jcc is a package and cannot be directly executed
>> make: *** [compile] Error 1
>> % /usr/bin/python -m jcc
>> /usr/bin/python: jcc is a package and cannot be directly executed
>> %
>>
>> What am I doing wrong?
>
>
> Python 2.6 doesn't support packages as target of -m. JCC has already a
> workaround that works on Python 2.5 and 2.6: "-m jcc.__main__".
>
> Christian


Re: building 2.4.1 on Linux (Ubuntu 9)

Posted by Christian Heimes <li...@cheimes.de>.
Bill Janssen wrote:
> /usr/bin/python: jcc is a package and cannot be directly executed
> make: *** [compile] Error 1
> % /usr/bin/python -m jcc
> /usr/bin/python: jcc is a package and cannot be directly executed
> %
> 
> What am I doing wrong?


Python 2.6 doesn't support packages as target of -m. JCC has already a
workaround that works on Python 2.5 and 2.6: "-m jcc.__main__".

Christian