ContinuumIO / nutchpy

For interacting with nutch via Python
Apache License 2.0
23 stars 16 forks source link

Unable to use LinkReader #18

Closed antrromet closed 8 years ago

antrromet commented 9 years ago

When tried to use link_reader instead of sequence_reader with the following command,

import os
import nutchpy

path = os.path.dirname(nutchpy.__file__)
path = os.path.join(path,"ex_data", "crawldb_data")
data = nutchpy.link_reader.read(path)

It crashed with the following logs

Traceback (most recent call last):
  File "/Users/Antrromet/Documents/LiClipse Workspace/NutchPy/src/seq_reader.py", line 16, in <module>
    data = nutchpy.link_reader.read(path)
  File "/Library/Python/2.7/site-packages/nutchpy/readers.py", line 25, in read
    data = self.reader.read(path)
  File "/Library/Python/2.7/site-packages/py4j-0.9-py2.7.egg/py4j/java_gateway.py", line 813, in __call__
    answer, self.gateway_client, self.target_id, self.name)
  File "/Library/Python/2.7/site-packages/py4j-0.9-py2.7.egg/py4j/protocol.py", line 308, in get_return_value
    format(target_id, ".", name), value)
py4j.protocol.Py4JJavaError: An error occurred while calling z:com.continuumio.seqreaderapp.LinkReader.read.
: java.io.IOException: wrong value class: url: null, anchor: , score: 0.0, timestamp: 0, link type: unknown is not class org.apache.nutch.crawl.CrawlDatum
    at org.apache.hadoop.io.SequenceFile$Reader.next(SequenceFile.java:1874)
    at com.continuumio.seqreaderapp.LinkReader.read(LinkReader.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:379)
    at py4j.Gateway.invoke(Gateway.java:259)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:207)
    at java.lang.Thread.run(Thread.java:745)

Out of all the readers mentioned here, only SequenceReader works.

chrismattmann commented 9 years ago

can you check the Nutch File Formats and make sure that the readers.py schema for LinkReader matches that?