#3565: Porting Python Scripting Library to Python 3
-------------------------------+-------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: task | Status: new
Priority: normal | Milestone: 8.0.0
Component: Python | Version: svn-trunk
Keywords: gsoc2018, python3 | CPU: Unspecified
Platform: All |
-------------------------------+-------------------------
This ticket is created to gather comments and patches to port this library
to Python 3 as part of GSoC 2018.
#3565: Porting Python Scripting Library to Python 3
--------------------------+-------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: task | Status: new
Priority: normal | Milestone: 8.0.0
Component: Python | Version: svn-trunk
Resolution: | Keywords: gsoc2018, python3
CPU: Unspecified | Platform: All
--------------------------+-------------------------------
Comment (by annakrat):
I changed Sanjeet's patch to change the behavior of encode and decode
functions in utils.py, so that they don't accept anything else than string
or bytes with Python3. Before they could be used with int, floats and
None, but it's supposed to do encoding/decoding not converting, that
should be done explicitly. To not break existing code, new behavior is
only with Python 3.
Hi, Here is a quick dirty patch to know if this is what you meant when you
said we need to have 'encoding' parameter passed to our functions. For
now, I have only added this conversion in the 'run_command()'. I am just
using the encoding parameter directly from kwargs instead of passing it as
a keyword argument in the functions definiton. It is being popped from the
kwargs dictionary so as not to pass it to the next function in line. I
thought, in the similar manner we could call the 'make_unicode()' in other
functions (read_command, make_command, start_command,...) where they can
make use of it if they are called directly from the scripts instead of
other functions. Is this correct?
#3565: Porting Python Scripting Library to Python 3
--------------------------+-------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: task | Status: new
Priority: normal | Milestone: 8.0.0
Component: Python | Version: svn-trunk
Resolution: | Keywords: gsoc2018, python3
CPU: Unspecified | Platform: All
--------------------------+-------------------------------
Comment (by annakrat):
Actually what I meant is using the encoding parameter only for stdin,
stderr and stdout, the same way as
[https://docs.python.org/3.6/library/subprocess.html#subprocess.Popen
Python Popen class]. The arguments are already being encoded in
start_command function. BTW, if you submit a patch, it should somehow
work, I can see just by looking at it that it can't work. Or call it
pseudocode in that case.