LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-27-2013, 12:51 PM   #1
xeon123
Member
 
Registered: Sep 2006
Posts: 374

Rep: Reputation: 16
Jython import error


I'm trying to build a unit test using jython, but when I run the example I get the error due to my import of the Sha1Hash. The error and the classes are below. I don't understand why. What's the error?

Running execution:
Code:
import org.apache.hadoop.mapreduce.security as Sha1Hash
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named apache

Python class
Code:
#!/usr/bin/env jython

import org.apache.hadoop.mapreduce.security as Sha1Hash

import unittest

class TestSha1Hash(unittest.TestCase):
    def test_sha1(self):
		sentence="The quick brown fox jumps over the lazy dog"
		print sentence

		#Sha1Hash sha = new Sha1Hash()


if __name__ == '__main__':
	unittest.main()
Java class:
Code:
package org.apache.hadoop.mapreduce.security;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.zip.GZIPInputStream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;
import org.apache.hadoop.io.compress.Decompressor;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.hash.Hash;

public class Sha1Hash extends Hash implements WritableComparable<Sha1Hash> {
....
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] MySQLdb import Error Breeze Linux - Software 1 04-25-2011 11:28 PM
Embedding Linux command in Jython script sfaseyik Programming 1 01-28-2010 08:38 PM
jython error kpachopoulos Programming 0 09-09-2007 04:11 AM
Python/jython games davholla Programming 1 01-07-2005 08:20 AM
Jython linuxRules Linux - Software 1 06-20-2002 11:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration