the-anylogic-company / AnyLogic-Pypeline

A custom AnyLogic library for running Python inside an AnyLogic model (Java)
https://github.com/the-anylogic-company/AnyLogic-Pypeline/wiki
MIT License
106 stars 26 forks source link

Deprecation warning from collections #2

Closed afmedina closed 4 years ago

afmedina commented 4 years ago

Hi!

When running pypeline with python 3.7.7, I received the following warning:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working

from collections import Mapping

I think the solution is simple, just change at Pypeline Library.alp: "from collections import Mapping",

To:

"try:",
    "from collections.abc import Mapping",
"except ImportError:",
    "from collections import Mapping",

This message appears because, as of python 3.3, some classes like Mapping were moved to the collections.abc module.

https://stackoverflow.com/questions/53978542/how-to-use-collections-abc-from-both-python-3-8-and-python-2-7

t-wolfeadam commented 4 years ago

Hi, thanks for reporting this! On further inspection, Mapping is actually unused in the Python code. I pushed an update with it removed, along with cleaning up other parts of the server. It'll be part of the next release :)