[MS4W-Users] error with command line tools after MS4W installation
Jeff McKenna
jmckenna at gatewaygeomatics.com
Thu Feb 9 10:35:40 EST 2017
Hi Michael,
(sorry for the long email that following, but it is necessary to explain
fully)
If you are using MS4W 3.2.0, that is compiled for Python 2.7.13; however
to be honest, if you are a Python user you should be migrating to MS4W
4.0 as it supports both Python 3.x and PHP 7.x (which is available for
testing and feedback in an Alpha release at
http://www.ms4w.com/release/experimental/). There is an awkward problem
now of supporting both Python and PHP 5.6, and the versions of compilers
they support (there was a long discussion of this in an MS4W ticket at
http://ms4w.com/trac/ticket/74).
However I did see this issue coming: so if you are using MS4W 3.2.0, it
actually includes a custom Python 2.7.13 build (python.exe), in hopes to
help this unfortunate situation for the short term. So here are the
steps (I admit they are not easy, but, until MS4W 4.0 comes along it is
a workaround):
- edit in a text editor: setenv.bat
- on line #7, add "\ms4w\Python;" before the "%PATH" near the end of
that line
- open a new Command Prompt window
- cd into ms4w
- execute: setenv.bat
- execute: python
(you should see python 2.7.13 usage)
- cd into \gdalbindings\python\gdal\
- execute: python gdal_merge.py
(you should see the gdal_merge usage)
So in the perfect world we will all soon switch to MS4W 4.0 (the
compiler for that supports both Python 3.5 and PHP 7); but it is a
little early, even though I am trying very hard to get there - if your
organization can help fund that along please contact me directly and
then the whole MS4W community benefits. Or if you need a custom build
sooner than that (such as for Python 2.x with latest libraries) please
also contact me directly.
But please be aware that MS4W 4.0 is the future and it is coming (with
Python 3 and PHP 7 support working nicely - that is the goal!).
That ticket that I referenced explains the confusing situation the best.
If you find problems please do file your tickets direct in the MS4W
tracker: http://ms4w.com/trac/ If you cannot provide funding to produce
the great MS4W that you organization needs, then you can for sure
provide feedback and testing through the MS4W tracker :)
Thanks,
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/
On 2017-02-09 6:16 AM, michael via MS4W-Users wrote:
> Dear MS4W users,
>
> I just downloaded MS4W.
> I would like to use the tool gdal2tiles.py .
>
> After having installed MS4W and ActiveState-Perl 3.5 I did the following
> in a command shell:
>
> - cd C:\ms4w
>
> - sentenv.bat
>
> - gdal_merge.py
>
> The result is below. Have I done wrong something? Do I need to set other
> environment variables?
>
> Thanks a lot!
>
> Michael
>
> Error message:
>
> Traceback (most recent call last):
> File "C:\ms4w\gdalbindings\python\gdal\gdal_merge.py", line 37, in
> <module>
> from osgeo import gdal
> File "C:\ms4w\gdalbindings\python\gdal\osgeo\__init__.py", line 21, in
> <module>
> _gdal = swig_import_helper()
> File "C:\ms4w\gdalbindings\python\gdal\osgeo\__init__.py", line 17, in
> swig_import_helper
> _mod = imp.load_module('_gdal', fp, pathname, description)
> File "C:\Python35\lib\imp.py", line 242, in load_module
> return load_dynamic(name, filename, file)
> File "C:\Python35\lib\imp.py", line 342, in load_dynamic
> return _load(spec)
> ImportError: DLL load failed: %1 is not a valid Win32 application.
>
More information about the MS4W-Users
mailing list