nerdocs / pydifact

A python EDIFACT library.
MIT License
154 stars 45 forks source link

Python <= 3.7 compat broken with 0.1.4 ? #47

Closed JocelynDelalande closed 2 years ago

JocelynDelalande commented 2 years ago

Platform : Debian buster.

    from pydifact.segmentcollection import RawSegmentCollection
/usr/local/lib/python3.7/dist-packages/pydifact/__init__.py:23: in <module>
    from pydifact import segmentcollection, parser, segments, serializer, token, tokenizer
/usr/local/lib/python3.7/dist-packages/pydifact/segmentcollection.py:37: in <module>
    class AbstractSegmentsContainer:
/usr/local/lib/python3.7/dist-packages/pydifact/segmentcollection.py:95: in AbstractSegmentsContainer
    self, name: str, predicate: Callable[[Segment], bool] = None
E   TypeError: 'ABCMeta' object is not subscriptable
nerdoc commented 2 years ago

ok, I'll have a look at it.

diogoo296 commented 2 years ago

I'm not sure if my issue is related by I had a similar problem but using Python 3.8.5 (macOS Monterey v12.0.1). I tried a simple import described in the readme "Usage" section and got this error:

from pydifact.segmentcollection import Interchange
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/diogo/.pyenv/versions/py385-apic/lib/python3.8/site-packages/pydifact/__init__.py", line 23, in <module>
    from pydifact import segmentcollection, parser, segments, serializer, token, tokenizer
  File "/Users/diogo/.pyenv/versions/py385-apic/lib/python3.8/site-packages/pydifact/segmentcollection.py", line 37, in <module>
    class AbstractSegmentsContainer:
  File "/Users/diogo/.pyenv/versions/py385-apic/lib/python3.8/site-packages/pydifact/segmentcollection.py", line 95, in AbstractSegmentsContainer
    self, name: str, predicate: Callable[[Segment], bool] = None
TypeError: 'ABCMeta' object is not subscriptable
yesleo111 commented 2 years ago

I have the same issue for python 3.8.5 version. is not compatible with the last uptdate pydifact.

kravciuk commented 2 years ago

Same error with python 3.6.15 (ubuntu)

pipenv run python manage.py pg_test --traceback Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "/www/integre/planning/.venv/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/www/integre/planning/.venv/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/www/integre/planning/.venv/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, *cmd_options) File "/www/integre/planning/.venv/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(args, **options) File "/mnt/hgfs/www/acoobe/Integre/planing/src/apps/procter_gamble/management/commands/pg_test.py", line 13, in handle from pydifact.segmentcollection import Interchange File "/mnt/hgfs/www/acoobe/Integre/planing/src/apps/pydifact/init.py", line 23, in from pydifact import segmentcollection, parser, segments, serializer, token, tokenizer File "/mnt/hgfs/www/acoobe/Integre/planing/src/apps/pydifact/segmentcollection.py", line 37, in class AbstractSegmentsContainer: File "/mnt/hgfs/www/acoobe/Integre/planing/src/apps/pydifact/segmentcollection.py", line 95, in AbstractSegmentsContainer self, name: str, predicate: Callable[[Segment], bool] = None TypeError: 'ABCMeta' object is not subscriptable

nerdoc commented 2 years ago

Sorry for the delay. I removed 3 lines, just annotations that seemed to have problems with Python versions <3..9. I tested pydifact with the pytest suite using python 3.6,3.7,3.9,3.10 - without errors. I'll upload a new version in a few minutes. Please test and report back... Thanks for your patience. But I'm busy at by day job with 60+hrs/week. Few time for programming.