thiagoralves / OpenPLC_v3

OpenPLC Runtime version 3
GNU General Public License v3.0
1.1k stars 442 forks source link

Port to python3 #99

Closed innir closed 4 years ago

innir commented 4 years ago

Hi,

it seems to be quite trivial to port OpenPLC to Python3. I ran 2to3 and there where only some brackets added to print statements and the like. The only real changes to be made where removing lines https://github.com/thiagoralves/OpenPLC_v3/blob/master/webserver/webserver.py#L2183-L2184 as Python3 is UTF-8 anyway. Should I create a PR?

thiagoralves commented 4 years ago

The webserver on the runtime is simple to port, as I wrote it thinking about Py3. The problem is with the Editor. Its codebase is quite old and rely on old libraries. If I port the runtime to Py3, it might generate incompatibilities on systems that need to run the Editor in Py2 at the same machine. That being said, feel free to create the PR. Just make sure that all the dependencies on the installer (background_installer.sh) are changed appropriately. Thanks!

On Wed, Nov 20, 2019 at 2:55 AM Philip Rinn notifications@github.com wrote:

Hi,

it seems to be quite trivial to port OpenPLC to Python3. I ran 2to3 and there where only some brackets added to print statements and the like. The only real changes to be made where removing lines

https://github.com/thiagoralves/OpenPLC_v3/blob/master/webserver/webserver.py#L2183-L2184 as Python3 is UTF-8 anyway. Should I create a PR?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thiagoralves/OpenPLC_v3/issues/99?email_source=notifications&email_token=AB63XPGKOYET3GALK7YSGEDQUTUOJA5CNFSM4JPOXNO2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2UR2BA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB63XPEDRE3HISY5HUK4NEDQUTUOJANCNFSM4JPOXNOQ .

innir commented 4 years ago

@thiagoralves I created a PR against the development branch now: https://github.com/thiagoralves/OpenPLC_v3/pull/100.

I don't think using Python 3 for the runtime does any harm for the editor, even if run on the same machine as the don't directly exchange Python data structures.

innir commented 4 years ago

@thiagoralves Sorry, the PR was not complete :-(

In Python 3 socket.send accepts only bytes and subprocess.Popen seems to behave differently as well.

I'll follow up with a new PR

innir commented 4 years ago

This should do the trick: #102

garretfick commented 4 years ago

@innir I think this is now merged. Can you confirm so that this can be closed?