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

issues while launching from windows 10 cmd #78

Closed apws closed 2 years ago

apws commented 2 years ago

hi, I installed j2py, found that its required to rename it to scripts/j2py.py and then I was forced to assign .py to python.exe (2.7), as this was assigned elsewhere (I dont know if this is not the root cause of problem below)

when I run j2py then, it immediatelly expects input from stdin and its unable even to try "j2py --version" nor "j2py --help". When I close Ctrl+Z the stdin, it outputs something, ya

Interesting is that when I open j2py.py in Wing IDE and try to DEBUG this file, having passed --help or --version, it works. ArgumentParser handles this well and does its job. When I pass say class.java as argument, then it expects it as inputfile and writes to stdout "IOError: No such file or directory." ...

from win cmd, I am simply unable to specify inputfile/outputfile as file, nor any arguments with -- ... I dont know python much, so no ArgumentParser issues, but it seems its somewhere near it. And I expect its somehow related to how win cmd works, as this tool was probably designed on linux. Interesting is that in IDE debugging its behaving differently

thanks

apws commented 2 years ago

this code simply returns None in opt.inputfile after return from configScript(argv) in win cmd shell, so ArgumentParser doesnt parse inputfile/outputfile arguments correctly - niside Wing IDE it works... j2py.py pastebin

later in runTransform at line 113 is opened sys.stdin for read because of filein '-' really the main cause is None stored into inputfile by ArgumentParser

I dont know why

apws commented 2 years ago

well, I found that this may be problem ... running with python "j2py.py" --help works on my machine too https://stackoverflow.com/questions/11695147/using-argparse-in-python-and-default-file-association

apws commented 2 years ago

ok, so THIS is correct registry open command for Python.File: "C:\Python27\python.exe" "%1" %* honestly, I only edited and resaved this in registry ... it was here!