IRT-Open-Source / scf

Subtitling Conversion Framework
Apache License 2.0
52 stars 18 forks source link

SCF 1.9.1 module issues with different Python versions #82

Open Jasonmight opened 3 years ago

Jasonmight commented 3 years ago

Hi there, My goal is to convert STL-Files into EBU-TT-DE-basic.

While SCF version 1.9.1 was still working with Python 3.7.9, it does not with Python 3.9.2 or 3.9.4. I have the following error while converting a STL-File into STLXML (Module: \scf\scf-1.9.1\modules\STL2STLXML\stl2stlxml.py):

"LookupError: unknown encoding: iso_6937-2"

Also some modules have stylesheet-issues (that is while working with older Python versions):

"Warning at xsl:stylesheet on line 32 column 19 of STLXML2EBU-TT.xslt: Running an XSLT 10 stylesheet with an XSLT 20 processor"

"Warning at xsl:stylesheet on line 21 column 72 of EBU-TT2EBU-TT-D.xslt: Running an XSLT 10 stylesheet with an XSLT 20 processor"

"Warning at xsl:stylesheet on line 20 column 86 of EBU-TT-D2EBU-TT-D-Basic-DE.xslt: Running an XSLT 10 stylesheet with an XSLT 20 processor"

Could you please help me with these problems? Thanks in advance

VanHoang85 commented 3 years ago

While SCF version 1.9.1 was still working with Python 3.7.9, it does not with Python 3.9.2 or 3.9.4. I have the following error while converting a STL-File into STLXML (Module: \scf\scf-1.9.1\modules\STL2STLXML\stl2stlxml.py): "LookupError: unknown encoding: iso_6937-2"

In case someone is still interested in this topic: https://docs.python.org/3/library/codecs.html#codecs.Codec.encode

codecs.register(search_function) Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens and spaces converted to underscores, and return a CodecInfo object. In case a search function cannot find a given encoding, it should return None. Changed in version 3.9: Hyphens and spaces are converted to underscore.

That being said, you need to replace all the hyphens in the custom encoding names with underscores. For example, iso_6937-2 --> iso_6937_2 And it works.