SeisComP3 / seiscomp3

SeisComP is a seismological software for data acquisition, processing, distribution and interactive analysis.
Other
111 stars 88 forks source link

[debug] python3 support #260

Closed AJamelot closed 4 years ago

AJamelot commented 4 years ago

Hi,

python3 updates on files :

src/system/apps/seiscomp/seiscomp src/system/libs/python/seiscomp3/Setup.py
src/system/libs/python/seiscomp3/Shell.py

Resolving bug on seiscomp setup and seiscomp shell. I began to debug seiscomp update-config.

src/trunk/apps/messaging/scmaster/config/scmaster.py (python3 : string as byte encoding)

Also added dnf scripts for centos 8 release for seiscomp install-deps

python 2.7 backward compatibility tested.

gempa-jabe commented 4 years ago

Thanks a lot for your fixes and additions. Please have a look to my comment maybe that part still needs your attention. Apart from that I am going to merge that.

AJamelot commented 4 years ago

I chose stdout encoding to decode var 'out[0]' because this var was created from the check_ouput() function , that return the output from a Popen command (by the way it seems to have a stdout and stderr output pipe into the same output).

def check_output(cmd): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) out = proc.communicate() return [out[0], out[1], proc.returncode]

I am not 100% sure but sys.stdout.encoding and sys.stderr.encoding.

To be more accurate from function above we should have ,

def check_output(cmd): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) out = proc.communicate() return [out[0].decode(sys.stdout.encoding), out[1].decode(sys.stderr.encoding), proc.returncode]

I'll give a try on this