Import problem with PyCrypto in Jython

Posted by Arg on Stack Overflow See other posts from Stack Overflow or by Arg
Published on 2010-06-10T18:31:51Z Indexed on 2010/06/10 21:22 UTC
Read the original article Hit count: 560

Filed under:


I am currently trying to get python bittorrent tracker running inside of jython and i encountered this problem: the tracker uses PyCrypto library which i compiled for my platform and added into the python path. When i try to run code, however, i get following error:

Exception in thread "MainThread" Traceback (most recent call last):
  File "./python_dep/BitTorrent-5.2.2/", line 21, in <module>
    from BitTorrent.track import track
  File "./python_dep/BitTorrent-5.2.2/BitTorrent/", line 50, in <module>
    from BitTorrent.UI import Size
  File "./python_dep/BitTorrent-5.2.2/BitTorrent/", line 37, in <module>
    from BitTorrent.MultiTorrent import UnknownInfohash, TorrentAlreadyInQueue, TorrentAlreadyRunning, TorrentNotRunning
  File "./python_dep/BitTorrent-5.2.2/BitTorrent/", line 25, in <module>
    from BitTorrent.Torrent import Feedback, Torrent
  File "./python_dep/BitTorrent-5.2.2/BitTorrent/", line 32, in <module>
    from BitTorrent.ConnectionManager import ConnectionManager
  File "./python_dep/BitTorrent-5.2.2/BitTorrent/", line 22, in <module>
    from BitTorrent.Connector import Connector
  File "./python_dep/BitTorrent-5.2.2/BitTorrent/", line 27, in <module>
    from Crypto.Cipher import ARC4
ImportError: cannot import name ARC4
Java Result: 1

I am pretty sure that the library is in the python path, because command

import Crypto.Cipher

works, while

from Crypto.Cipher import ARC4

does not. The java code i run looks like this:

package jythTest;

import org.python.util.PythonInterpreter;

public class Main {

    public static void main(String[] args) {
         PythonInterpreter pythonInterpreter = new PythonInterpreter();
         pythonInterpreter.exec("import sys");

         pythonInterpreter.exec("sys.path.append(\"import Crypto.Cipher\")");

         //pythonInterpreter.exec("print sys.path");

Thanks in advance to anyone who could provide any kind of help.

© Stack Overflow or respective owner

Related posts about python

Related posts about jython