dan-da / py2php

py2php is a utility that will auto-translate python code into PHP code.
GNU General Public License v2.0
99 stars 32 forks source link

Question on py2php #3

Closed Brzusto closed 7 years ago

Brzusto commented 7 years ago

Dear dan-da,

I am very interested in your script. How does this handle imports ?

Is this only translating python code that does not include any library ?

Congratulations for the tool you built.

dan-da commented 7 years ago

How does this handle imports ?

It converts the "import xxxx.py" to "require_once('xxxx.php')". In most/many cases that won't work and you'll need to do the right thing manually.

Is this only translating python code that does not include any library ?

right. it translates one source code file at a time.

If you have the source to the library, it could possibly be translated also.

For all but the simplest cases, additional porting work will be required for each source file, but py2php handles much of the routine grunt work.

Some of the common python builtins are emulated using a php library included with py2php.