Opened 14 years ago

Last modified 12 years ago

#162 new enhancement

pythonwin launcher

Reported by: wildintellect Owned by: osgeo4w-dev@…
Priority: major Component: Package
Version: 1.0 Keywords: python pythonwin


When trying to use python libs included in the OSGeo4w install they sometimes fail due to various path issues. It would be great if running python or any python IDE out of OSGeo4w would work for importing osgeo(gdal ogr), shapely, liblas etc.

Attached bat file is for launching the pythonwin editor that is included with OSGeo4w, but with correct paths to allow loading GDAL/OGR bindings. I have not been successful in getting liblas(might be related to ticket:119) and have yet to try shapely and the other libs. A note though, pythonwin when launched even with this bat file appears to be using the system installed python not the OSGeo4w included python. (This may help solve ticket:114)

Attachments (1)

OSGeo4Wpythonwin.bat (586 bytes ) - added by wildintellect 12 years ago.
Bat file to launch Pythonwin inside of OSGeo4w

Download all attachments as: .zip

Change History (4)

by wildintellect, 12 years ago

Attachment: OSGeo4Wpythonwin.bat added

Bat file to launch Pythonwin inside of OSGeo4w

comment:1 by wildintellect, 12 years ago

Keywords: pythonwin added
Summary: python library availabilitypythonwin launcher
Type: defectenhancement

I've uploaded a new version of the bat file to launch Pythonwin. This one is more dynamically coded to allow for future python version changes and corrected to work with the current OSGeo4w install. Along with this bat file we should add a Desktop/Menu item when python is installed to run this file.

comment:2 by maphew, 12 years ago

For the short term, I would install the pkg-shell which ensures a shell with all the correct environment variables set (meaning if, for example, qgis changes it's python plugin path your bat file will automatically be up to date). And then call pythonwin after running Osgeo4W.bat with:

start "PythonWin" /B "%pythonhome%\lib\site-packages\pythonwin\Pythonwin.exe" %*

More properly we should re-package pkg-python-win32 with pythonwin.exe in .\bin and desktop shortcut.

((I wonder if we should also change the end of osgeo4w.bat to @cmd /c %* to allow things like call osgeo4w.bat pythonwin?))

comment:3 by maphew, 12 years ago

I put together a version of [pkg-python-win32] which creates desktop and startmenu links. It's in the testing repository as python-win32-2.16-2.tar.bz2; Jürgen Fischer is the maintainer and I didn't want to step on his toes. Changes from the default package are:

  • added bin\pythonwin.bat, etc\postinstall\pythonwin.bat
  • changed setup.hint to rely on shell instead of msvcrt

To work effectively pkg-shell must be v1.0.0-8+

:: bin\pythonwin.bat
start /b %pythonhome%\Lib\site-packages\pythonwin\pythonwin.exe %*
:: etc\postinstall\pythonwin.bat
xxmklink "%OSGEO4W_STARTMENU%\PythonWin.lnk" "%OSGEO4W_ROOT%\OSGeo4W.bat" pythonwin \ "Python for Windows, using Osgeo4W python" 7 "%pythonhome%\lib\site-packages\pythonwin\Pythonwin.exe"
xxmklink "%ALLUSERSPROFILE%\Desktop\PythonWin.lnk" "%OSGEO4W_ROOT%\OSGeo4W.bat" pythonwin \ "Python for Windows, using Osgeo4W python" 7 "%pythonhome%\lib\site-packages\pythonwin\Pythonwin.exe"

I was unable to test with the osgeo-setup-testing.exe as it kept giving me errors about the mirror url's being out of date, and wouldn't accept my user entered url as an alternative.

Note: See TracTickets for help on using tickets.