Skip to content

Commit 8bb3410

Browse files
committed
Add troubleshooting notes
1 parent a9e4ef3 commit 8bb3410

1 file changed

Lines changed: 38 additions & 14 deletions

File tree

mapscript/python/README.rst

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,6 @@ Now you should be able to import mapscript:
127127
python -c "import mapscript;print(mapscript.msGetVersion())"
128128
MapServer version 7.6.0 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
129129
130-
If you failed to add the MapServer binaries to your system path you may see one of the following errors:
131-
132-
.. code-block:: python
133-
134-
ImportError: No module named _mapscript # Python 2.x
135-
ModuleNotFoundError: No module named '_mapscript' # Python 3.x
136-
137-
If your version of mapscript does not match your version of MapServer you may instead one of the following messages:
138-
139-
.. code-block:: python
140-
141-
ImportError: DLL load failed: The specified module could not be found.
142-
ImportError: DLL load failed: The specified procedure could not be found.
143-
144130
Installation on Unix
145131
--------------------
146132

@@ -175,6 +161,44 @@ In summary the ``install`` target runs the ``setup.py install`` command using cu
175161

176162
python setup.py install --root=${DESTDIR} --prefix={CMAKE_INSTALL_PREFIX}
177163

164+
Installation Troubleshooting
165+
----------------------------
166+
167+
If the ``_mapscript.pyd`` (or ``_mapscript.so`` on Unix) is missing from the `Lib/site-packages/mapscript`
168+
folder (which can happen if the source installation is installed rather than a pre-compiled version) the following error will occur:
169+
170+
.. code-block:: python
171+
172+
ImportError: cannot import name '_mapscript' from partially initialized module 'mapscript' (most likely due to a circular import)
173+
174+
If the mapscript library is not on your ``PYTHONPATH`` you may see one of the following errors:
175+
176+
.. code-block:: python
177+
178+
ImportError: No module named _mapscript # Python 2.x
179+
ModuleNotFoundError: No module named '_mapscript' # Python 3.x
180+
181+
If the ``MapServer.dll`` cannot be found in your system paths (or ``MAPSERVER_DLL_PATH`` environment variable when using Python 3.8
182+
or higher on Windows) you will see the following message:
183+
184+
.. code-block:: python
185+
186+
ImportError: DLL load failed: The specified module could not be found.
187+
188+
If MapServer has been built with a dependency also used by Python, and the versions don't match you may see the error below.
189+
This is a particular problem on Windows with ``sqlite3.dll`` as it is used by both Python and MapServer. Copying the ``sqlite3.dll``
190+
from the MapServer binaries folder alongside ``_mapscript.pyd`` in `Lib/site-packages/mapscript` can resolve this.
191+
192+
.. code-block:: python
193+
194+
ImportError: DLL load failed: The specified procedure could not be found.
195+
196+
If you are using 32 bit Python on Windows and attempt to use a 64 bit version of MapScript the following import error will occur:
197+
198+
.. code-block:: python
199+
200+
ImportError: DLL load failed while importing _mapscript: %1 is not a valid Win32 application.
201+
178202
Quickstart
179203
----------
180204

0 commit comments

Comments
 (0)