dan-da/py2php

Incomplete script at the end?

Closed this issue · 6 comments

Hi, I'm looking for a script like yours. It seems fine yet I receive an error when trying to run it.

Is a version of py2php script cut at the end?

Here's the shell output on MacBook Pro:

print translate(file_name, module_name), File "./py2php", line 1134, in translate t = Translator(module_name, mod, output) File "./py2php", line 90, in **init** self._class(child) File "./py2php", line 561, in _class self._method(child, current_klass, class_name) File "./py2php", line 595, in _method self._function(node, True) File "./py2php", line 251, in _function self._stmt(child, None) File "./py2php", line 678, in _stmt self._assign(node, current_klass) File "./py2php", line 783, in _assign raise TranslationError("unsupported type (in _assign)", v) __main__.TranslationError: line 10: unsupported type (in _assign) AssTuple([AssAttr(Name('self'), 'x', 'OP_ASSIGN'), AssAttr(Name('self'), 'y', 'OP_ASSIGN')])

The script runs without error on my system. Below is output from a
fresh git clone.... it generates the PHP test cases from python test
cases. Please try these commands first to verify your installation is OK.

git clone https://github.com/dan-da/py2php.git
Cloning into 'py2php'...
remote: Counting objects: 49, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 49 (delta 12), reused 44 (delta 10), pack-reused 0
Unpacking objects: 100% (49/49), done.
Checking connectivity... done.
danda@t61:/tmp$ cd py2php/
danda@t61:/tmp/py2php$ cd tests/
danda@t61:/tmp/py2php/tests$ ./gen_all_tests
augassign.py --> augassign.py.php. generating...
done!
bankaccount.py --> bankaccount.py.php. generating...
done!
elem_search.py --> elem_search.py.php. generating...
done!
fibonacci.py --> fibonacci.py.php. generating...
done!
gameboard.py --> gameboard.py.php. generating...
done!
range.py --> range.py.php. generating...
done!

On 12/04/2015 01:27 PM, Matt S Rinc wrote:

Hi, I'm looking for a script like yours. It seems fine yet I receive
an error when trying to run it.

Is a version of py2php script cut at the end?


Reply to this email directly or view it on GitHub
#1.

Dan Libby

Open Source Consulting S.A.
Santa Ana, Costa Rica
http://osc.co.cr
phone: 011 506 2204 7018
Fax: 011 506 2223 7359

Thanks, tests are OK! I guess I try to convert too complex script in Python.

It doesn't matter anymore (client decided otherwise) yet I really appreciate your help and will probably use your script in the future.

ok, if you can attach the python script I will take a look at why it is crashing.

nevermind. It turns out this was a problem with tuple assignment. I just added code and a test case for tuple assignment. You can give it a try if you like.

Thanks but sorry, I'm still more a Python beginner (my platforms are Delphi, C, Java, javascript and PHP).

Here's the link to a Python file (demanding, requires PyOpenGL) that I wanted to convert to PHP (at least the code, not the GUI):

https://github.com/zhicheng/pathfinder/blob/master/main.py

Hey I just pushed some fixes. The biggest thing was adding support for lambda functions. Your main.py file translates without error now, in case you'd like to try it.