[mapserver-users] Mapscript circular import error inside Python-Flask Docker
aditya kudekar
adityakudekar.ak at gmail.com
Mon Feb 8 01:19:37 PST 2021
I have a simple flask app and I am trying to run in Docker
import mapscriptfrom flask import Flaskimport json
app = Flask(__name__)
port = 5000
@app.route("/hello")def geocoder():
epsg = mapscript.pointObj(1, 1)
return json.dumps(epsg)
test()
if __name__ == '__main__':
app.run(host="0.0.0.0", port=port)
My Dockerfile is:
FROM python
WORKDIR /opt/demo/
COPY /app .
RUN pip install -r requirements.txt
ENTRYPOINT python test.py
But I get the following error when I run docker run -p 5000:5000 test:latest
:
Traceback (most recent call last):
File "/opt/demo/test.py", line 1, in <module>
import mapscript
File "/usr/local/lib/python3.9/site-packages/mapscript/__init__.py",
line 2, in <module>
from .mapscript import *
File "/usr/local/lib/python3.9/site-packages/mapscript/mapscript.py",
line 13, in <module>
from . import _mapscript
ImportError: cannot import name '_mapscript' from partially
initialized module 'mapscript' (most likely due to a circular import)
(/usr/local/lib/python3.9/site-packages/mapscript/__init__.py)
This happens only when I have the Python VENV activated when running
outside Docker but I don't know why I am getting this error inside Docker.
Warm Regards
Aditya Rajendra Kudekar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20210208/a6550c83/attachment.htm>
More information about the MapServer-users
mailing list