java2python icon indicating copy to clipboard operation
java2python copied to clipboard

pip installation failed, 'long' installation works

Open funderburkjim opened this issue 10 years ago • 2 comments

Just a mention that might be of use to other users.

I had some problems with installation.
My first try was using the quick 'pip install java2python'

  • When doing this with python 2.7.9, the following error occurred:
Collecting java2python
  Using cached java2python-0.5.0.tar.gz
Collecting antlr-python-runtime==3.1.3 (from java2python)
←[31m  Could not find a version that satisfies the requirement antlr-python-runt
ime==3.1.3 (from java2python) (from versions: )←[0m
←[33m  Some externally hosted files were ignored as access to them may be unreli
able (use --allow-external antlr-python-runtime to allow).←[0m
←[33m  Some insecure and unverifiable files were ignored (use --allow-unverified
 antlr-python-runtime to allow).←[0m
←[31m  No matching distribution found for antlr-python-runtime==3.1.3 (from java
2python)←[0m
  • When doing the 'long install' method, things worked (though some of the links to antler in the java2python docs are old). Here are steps that worked (I did this in a 'GitBash shell' under Windows OS):
    • download http://www.antlr3.org/download/antlr-3.1.3.tar.gz
    • tar xfz antlr-3.1.3.tar.gz
    • cd antlr-3.1.3/runtime/Python/
    • python setup.py install
    • download https://github.com/downloads/natural/java2python/java2python-0.5.1.tar.gz
    • tar xfz java2python-0.5.1.tar.gz
    • cd java2python-0.5.1
    • python setup.py install
  • j2py now works as advertised.
  • The above method does not get the tests, but they may be obtained by downloading a zip of this Github repository.

Two minor nitpicks on the action of j2py:

  • Empty If-then-else clauses need a 'pass' action, or Python complains
  • Many of the comments are moved from their original location in the Java file. Would be better if they were left in at least approximate original locations.

Thanks for making this available. It will save a lot of time in converting a 2000 line Java program.

funderburkjim avatar May 18 '15 20:05 funderburkjim

Thanks @funderburkjim, this helped :)

switchfootsid avatar Dec 30 '15 10:12 switchfootsid

Running J2Py this is what I get.

antlr_version = version_str_to_tuple("3.1.3 Mar 18, 2009 10:09:25") NameError: name 'version_str_to_tuple' is not defined

stixoffire avatar Apr 01 '20 23:04 stixoffire