elementpath icon indicating copy to clipboard operation
elementpath copied to clipboard

TypeError on GraalPy 24.1.2

Open hapasa opened this issue 11 months ago • 2 comments

pip install elementpath

Installs fine when using graalpy-24.1.2-linux-amd64.tar.gz but when trying to use it, it fails:

import elementpath Traceback (most recent call last): File "", line 1, in File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/init.py", line 36, in from .xpath2 import XPath2Parser File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/xpath2/init.py", line 15, in from ._xpath2_constructors import XPath2Parser File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/xpath2/_xpath2_constructors.py", line 28, in from ._xpath2_functions import XPath2Parser File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/xpath2/_xpath2_functions.py", line 39, in from elementpath.regex import RegexError, translate_pattern File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/regex/init.py", line 18, in from .unicode_subsets import UnicodeSubset, UnicodeData, install_unicode_data, File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/regex/unicode_subsets.py", line 552, in __unicode_data = UnicodeData() File "/home/harri/test/graalpy-24.1.2-linux-amd64/venv/lib/python3.11/site-packages/elementpath/regex/unicode_subsets.py", line 487, in init raise TypeError(f"can't get version {version} from module") TypeError: can't get version 11.0.0 from module

This comes from the fact that "from unicodedata import unidata_version" gets "11.0.0" on GraalPy, which is not in

UNICODE_VERSIONS = [ '12.1.0', '13.0.0', '14.0.0', '15.0.0', '15.1.0', '16.0.0' ]

in unicode_categories.py.

I'm not really sure if this a GraalPy problem, or elementpath problem, so I reported it in both. https://github.com/oracle/graalpython/issues/477

hapasa avatar Feb 14 '25 17:02 hapasa

Hi,

elementpath includes the unicodedata versions of the supported Python releases. The module that defines the codepoint sets for categories can be rebuilt if necessary using a script.

Generating a support for more unicode versions slow down the load of that module. Anyway a better solution in elementpath for the future is to use EAFP tecnique, emitting a warning in these cases but build Unicode categories on-the fly (that could be pretty slow if a download of the Unicode sources is needed).

thank you

brunato avatar Feb 18 '25 08:02 brunato

Hi,

Thanks for looking into this. Seems this is fixed at GraalPy side in the upcoming version 25.xx which supports unicode version 16.

Best, Harri

On Tue, Feb 18, 2025 at 9:42 AM Davide Brunato @.***> wrote:

Hi,

elementpath includes the unicodedata versions of the supported Python releases. The module that defines the codepoint sets for categories can be rebuilt if necessary using a script https://github.com/sissaschool/elementpath/blob/a229b0c8740ebb1ea16025a6c8b5cb3500038e90/scripts/generate_codepoints.py .

Generating a support for more unicode versions slow down the load of that module. Anyway a better solution in elementpath for the future is to use EAFP tecnique, emitting a warning in these cases but build Unicode categories on-the fly (that could be pretty slow if a download of the Unicode sources is needed).

thank you

— Reply to this email directly, view it on GitHub https://github.com/sissaschool/elementpath/issues/85#issuecomment-2664953910, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6UBMLWLGBO5UDPKJR4QC32QLXARAVCNFSM6AAAAABXFEBXBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRUHE2TGOJRGA . You are receiving this because you authored the thread.Message ID: @.***> [image: brunato]brunato left a comment (sissaschool/elementpath#85) https://github.com/sissaschool/elementpath/issues/85#issuecomment-2664953910

Hi,

elementpath includes the unicodedata versions of the supported Python releases. The module that defines the codepoint sets for categories can be rebuilt if necessary using a script https://github.com/sissaschool/elementpath/blob/a229b0c8740ebb1ea16025a6c8b5cb3500038e90/scripts/generate_codepoints.py .

Generating a support for more unicode versions slow down the load of that module. Anyway a better solution in elementpath for the future is to use EAFP tecnique, emitting a warning in these cases but build Unicode categories on-the fly (that could be pretty slow if a download of the Unicode sources is needed).

thank you

— Reply to this email directly, view it on GitHub https://github.com/sissaschool/elementpath/issues/85#issuecomment-2664953910, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6UBMLWLGBO5UDPKJR4QC32QLXARAVCNFSM6AAAAABXFEBXBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRUHE2TGOJRGA . You are receiving this because you authored the thread.Message ID: @.***>

hapasa avatar Feb 19 '25 21:02 hapasa

Hi, with latest version (v5.0.0) at runtime, if there is a mismatch of the Unicode data, a UnicodeWarning is generated and the Unicode categories are created using the API of unicodedata module. This avoid the raise but report the problem on Unicode version used against the Python version.

Best

brunato avatar Apr 27 '25 21:04 brunato