natural / java2python

Simple but effective library to translate Java source code to Python.
GNU Lesser General Public License v2.1
564 stars 243 forks source link

ANTLR 3.1.3 not found #40

Open smsaladi opened 8 years ago

smsaladi commented 8 years ago

When trying to install with

pip install java2python

I get the following error message:

(py27)➜ Downloads pip install java2python Collecting java2python Using cached java2python-0.5.0.tar.gz Collecting antlr-python-runtime==3.1.3 (from java2python) Could not find a version that satisfies the requirement antlr-python-runtime==3.1.3 (from java2python) (from versions: ) No matching distribution found for antlr-python-runtime==3.1.3 (from java2python)

I think the installation instructions might need updating to reflect that the section Install ANTLR Runtime is necessary regardless of whether pip install java2python is used or not.

smsaladi commented 8 years ago

I can make the change and submit a PR if you agree.

mdaffern commented 8 years ago

@smsaladi it looks like the installs will work when using the following commands:

pip install http://antlr3.org/download/Python/antlr_python_runtime-3.1.3.tar.gz
pip install https://github.com/downloads/natural/java2python/java2python-0.5.1.tar.gz

I am using python 2.7.11 though. Not sure if this will help if you add the antlr url into the setup file.

yucer commented 8 years ago

I had the same problem. Installing those two packages. the error is gone during the setup.

But then I receive this error while processing specific .java files:

  File "/home/yucer/.virtualenvs/j2p/local/lib/python2.7/site-packages/java2python/mod/basic.py", line 151, in getSyncHelpersSrc
    from java2python.mod.include import sync
ImportError: No module named include

It results that the include folder is newer than that version.

How can we overcome that error?

yucer commented 8 years ago

I did solve the problem installing the last version:

> mkvirtualenv j2p
> pip install http://antlr3.org/download/Python/antlr_python_runtime-3.1.3.tar.gz
> git clone https://github.com/natural/java2python.git
> pip install -e java2python

and then using the j2p virtualenv for running it:

> workon j2p
> cd java/code/folder
> j2py myFile.java
jiangwuyue commented 3 years ago

python j2py \Mac\Home\Downloads\MonkeyCreateScript-master\MonkeyCreateScript\src\com\jikexueyuan\EventModel.java python: can't open file 'j2py': [Errno 2] No such file or directory

yucer commented 3 years ago

python j2py \Mac\Home\Downloads\MonkeyCreateScript-master\MonkeyCreateScript\src\com\jikexueyuan\EventModel.java python: can't open file 'j2py': [Errno 2] No such file or directory

try to remove python from the command line. Or use python -m to run it instead of python-