Installing java2python (Newbie)

L

loveline17

Hi guys, I'm having a hard time installing java2python (
http://code.google.com/p/java2python/ )
on my Windows XP 32-bit machine. I double click setup.py but nothing
happens. Is there any specific Python sub-folder where I should put it
and install using command line? Even when I use command-line, I get
the error "install is not defined" etc. etc.

java2python needs Antlr (other than Python 2.X obviously) which I
already installed by double-clicking the .msi file.

Thanks for any help!!
 
J

Jeremy Dillworth

I haven't used that particular package, but the norm for setup.py is
this command line:

python setup.py install

Hope this helps,

Jeremy
 
L

loveline17

Hi Jeremy, that's the problem I'm having. Where should I type that "
python setup.py install" ? Once again I'm using Windows system and not
Unix. Should I move the file to a specific folder under Python 2.5 and
then type " python setup.py install" in IDLE or Command Line window?
I get the error "SyntaxError: invalid syntax" with the word "setup"
 
J

Jeremy Dillworth

You'll need to run the command in the command-line window. If you're
unfamiliar, here's how to start it up: Click "Start" then "Run..."
then type "Cmd" in the open field. Click OK.

Once you're at the command line there will be a little variation
depending on where things are located on your PC. If Python is
installed properly, you should be able to invoke the Python
interpreter from the command-line regardless of your current working
directory, so you don't need to unzip java2python under the Python 2.5
folder. You should do something like this:

cd \path\to\java2python\unzipped
python setup.py install
 
T

troy.melhase

Hi Jeremy, that's the problem I'm having. Where should I type that "
python setup.py install" ? Once again I'm using Windows system and not
Unix. Should I move the file to a specific folder under Python 2.5 and
then type " python setup.py install" in IDLE or Command Line window?
I get the error "SyntaxError: invalid syntax" with the word "setup"

hi andy,

you want to run the windows command prompt, which is called "cmd.exe"
in windows xp. press the "start menu", then select "run", then type
"cmd.exe" without the quotes.

a window will pop up that looks black, and it will have a prompt like
"C:\" or "D:\something". with this window, you need to type several
commands. the first command is "cd", which changes the working
directory. you'll want to type the name of the drive and folder where
you extracted the j2py package. this can be anywhere, and it doesn't
have to be in your python folders. example:

C:\> cd D:\temp\java2python-0.2

next, you'll need to run the setup script with python. you can test
for python at the prompt like this:

D:\temp\java2python-0.2\> python -V

if you get "Python 2.5", you're ready to run the script. if you don't
get that, or if you get something along the lines of "command not
found", then you'll have to qualify the command with the full path to
the 2.5 interpreter. for example:

D:\temp\java2python-0.2\> C:\Python2.5\python.exe -V

i don't know where you installed python, nor do i remember much about
how the windows installation layout, so you'll have to figure out
these paths on your own.

once you get the "Python 2.5" response, you can install the package.
this is the easy part. use whatever command you got to reply "Python
2.5", enter it again, along with a space followed by "setup.py
install" (again, no quotes). continuing the example above:

D:\temp\java2python-0.2\> C:\Python2.5\python.exe setup.py install

you should read all of the output closely -- look for errors. you
might have problems installing the software if you're not an
administrator.

if you don't have problems, the setup process will have copied a
script named "j2py" somewhere in your system path. try "j2py --
version", and if everything works, you'll get the reply "j2py 0.2".
once the script is installed, change to the directory of your java
files (using "cd"), then do something like this, substituting your
file names where appropriate:

D:\myjavafiles\> j2py -i someclass.java -o someclass.py

best of luck to you, and please do let me (or the group) know how
everything works out.
 
L

loveline17

Hi Troy, once again thanks for the quickie. I installed everything
properly now (error free!! yay) and the j2py script is located under :
C:\Documents and Settings\Ujjal Pathak\Desktop\java2python-0.2\build
\scripts-2.5

Meaning under scripts-2.5 folder, there are two files j2py and
jast_print but without any file extension though!

Here's the screenie : http://img241.imageshack.us/img241/675/95456528nk3.png

Once I fixed the path for both Python and j2py, only Python seems to
be working but not j2py.

Here is the screenie : http://img81.imageshack.us/img81/1796/51776836tf4.png

So, I wonder what might be the problem now? ^^ :)
 
T

Troy Melhase

properly now (error free!! yay) and the j2py script is located under :
C:\Documents and Settings\Ujjal Pathak\Desktop\java2python-0.2\build
\scripts-2.5

that doesn't look right -- it looks like you found what the setup
script left behind. what you should look for is j2py in either (a)
your python directories or (b) in your system directories. look in
c:\python2.5 first.
Meaning under scripts-2.5 folder, there are two files j2py and
jast_print but without any file extension though!

correct, they don't have extensions. once you find the real scripts,
rename them to include the .py extension. these scripts are meant to
run from a prompt, and double-clicking them in the windows file
manager won't do any good.
 
J

John Machin

hi andy,

you want to run the windows command prompt, which is called "cmd.exe"
in windows xp. press the "start menu", then select "run", then type
"cmd.exe" without the quotes.

Hi Troy, Windows users don't really "want" to do that. They'd prefer
to download a Windows installer, and "double-click on it".

http://docs.python.org/dist/postinstallation-script.html

This might save some wear'n'tear on their nervous systems, and
yours :)

HTH,
John
 
T

Troy Melhase

Hi Troy, Windows users don't really "want" to do that. They'd prefer
to download a Windows installer, and "double-click on it".

Hi John,

Understood and agreed. I was thinking about Andy's problem, and I
realized that many users would benefit from a gui to do side-by-side
translation. If I ever have the time, I could write one I think.
> This might save some wear'n'tear on their nervous systems, and
yours :)

Like so many projects, it works for me the way it is -- I'm driving
j2py via makefiles, and a gui just isn't something I need. But of
course patches are welcome -- even gui ones!
 
J

John Machin

Hi John,

Understood and agreed. I was thinking about Andy's problem, and I
realized that many users would benefit from a gui to do side-by-side
translation. If I ever have the time, I could write one I think.



Like so many projects, it works for me the way it is -- I'm driving
j2py via makefiles, and a gui just isn't something I need. But of
course patches are welcome -- even gui ones!

Did you think I was suggesting that you write a GUI version of
java2python? Please carefully (re)?read the documentation link that I
gave you. The idea is that with a simple variation of your setup.py
build comamnd, you create a Windows installer for your existing
package, and make it available for download. Then, all the Windows
user has to do is to double-click on it, and it guides them through
the installation. This would save wear'n'tear on you having to try to
explain to some newbie Windows user how to install your package.

HTH take 2,
John
 
T

Troy Melhase

Did you think I was suggesting that you write a GUI version of
java2python? Please carefully (re)?read the documentation link that I
gave you. The idea is that with a simple variation of your setup.py
build comamnd, you create a Windows installer for your existing
package, and make it available for download. Then, all the Windows
user has to do is to double-click on it, and it guides them through
the installation. This would save wear'n'tear on you having to try to
explain to some newbie Windows user how to install your package.

You're right, and what I didn't communicate was the thought process
that was between "users need an installer" and "users need a gui". I
jumped to the end and only typed that. Sorry for any confusion.
 
J

John Machin

You're right, and what I didn't communicate was the thought process
that was between "users need an installer" and "users need a gui". I
jumped to the end and only typed that. Sorry for any confusion.

I doubt that users need a GUI (but TMMV of course).

No need to say sorry -- I wasn't confused :)
Cheers,
john
 
D

Dennis Lee Bieber

Hi Troy, Windows users don't really "want" to do that. They'd prefer
to download a Windows installer, and "double-click on it".
I'll just chime in with a confirmation....

I've been bitten half a dozen times by downloading some package,
unzipping it, and seeing a "setup.py" icon in a directory (M$ file
explorer) window. So... naturally I double-click it. Only to have that
fail, followed by having to open a command shell (at least I put that on
my "start" menu), navigating to the directory of the unzip, and then
typing the full command.

Even a simple "setup_windows.bat", that only contains the single
line of "python setup.py install", would probably alleviate some of the
hassles encountered by Windows users.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
M

MRAB

hi andy,

you want to run the windows command prompt, which is called "cmd.exe"
in windows xp. press the "start menu", then select "run", then type
"cmd.exe" without the quotes.
[snip]
FYI, a quicker way to the command prompt is Start->All Programs-
 
G

Gabriel Genellina

FYI, a quicker way to the command prompt is Start->All Programs-

I dont like navigating deep menu structures... I prefer [WindowsKey]+R,
cmd, [Enter]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top