[osgeo4w-dev] [osgeo4w] #357: python 2.7.4 dll conflicts
OSGeo4W
trac_osgeo4w at osgeo.org
Thu Apr 25 00:34:18 PDT 2013
#357: python 2.7.4 dll conflicts
-------------------+--------------------------------------------------------
Reporter: maphew | Owner: osgeo4w-dev@…
Type: defect | Status: new
Priority: major | Component: Package
Version: | Keywords: python
-------------------+--------------------------------------------------------
Comment(by maphew):
the sqlite problem has been fixed by removing `sqlite3.dll` from python-
core package and making it require pkg-sqlite (which had been done for
previous release, but I overlooked for this one).
The issue arising from duplicate yet conflicting python27.dll's in PATH
is, strictly speaking, not our problem unless the dupe is from within the
o4w system (the ones reported aren't). I do have an idea to help people
though and am interested in feedback on the soundness of it:
If we replace `etc\ini\python.bat` with the below, on each invocation of
osgeo4w shell it will search PATH for the presence of duplicate
PythonXX.dll's and issue a warning if found.
{{{
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27
@call :check_path
SET PATH=%PATH%;%OSGEO4W_ROOT%\apps\Python27\Scripts
goto :eof
:check_path
@echo off
setlocal
set _DLL=%PYTHONHOME:~-8,8%.dll
for %%G in ("%path:;=" "%") do (
if exist %%G\%_DLL% call :conflicted %%G %_DLL%
)
if exist %SYSTEMROOT%\SysWOW64\%_DLL% call :conflicted
%SYSTEMROOT%\SysWOW64 %_DLL%
if "%_delay%"=="yes" ping -n 10 localhost > nul
endlocal
goto :eof
:conflicted
echo.
echo. **** Possibly conflicting %2 found in
echo. **** %1
echo. Please see http://trac.osgeo.org/osgeo4w/wiki/pkg-python/xxxxx
echo.
set _delay=yes
goto :eof
}}}
sample result:
{{{
B:\>SET PYTHONHOME=B:\o4w\\apps\Python27
**** Possibly conflicting Python27.dll found in
**** "C:\Program Files\TortoiseHg\"
Please see http://trac.osgeo.org/osgeo4w/wiki/pkg-python/xxxxx
**** Possibly conflicting Python27.dll found in
**** C:\Windows\SysWOW64
Please see http://trac.osgeo.org/osgeo4w/wiki/pkg-python/xxxxx
B:\>
}}}
Why I'm a bit leary of this: a) a very simple 2 line batch file anyone can
understand is a dozen times longer and leverages some arcane CMD
processing ==> harder to maintain, b) if this becomes standard practice
for every DLL issue we end up with a lot of special case code ==> harder
to maintain. '''However''' in spite of this, it does seem to work and it
would save time troubleshooting, especially for those whom the ini
directory and shell setup is not usually even given a passing glance. Your
thoughts?
--
Ticket URL: <http://trac.osgeo.org/osgeo4w/ticket/357#comment:1>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.
More information about the osgeo4w-dev
mailing list