sorry, the other answer went without the list. For popen, here is not tested snipped to give you a jump start. The docs for subprocess.popen are your friend.
import subprocess args = ["replace with full path to ogr2ogr.exe", osm_filePath, shps_filePath, "--config", "OSM_USE_CUSTOM_INDEXING", "NO", "-skipfailures", "-f", "ESRI Shapefile"] p = subprocess.Popen(args) p.wait() if p.returncode: print "failed with errorlevel %s" % p.returncode the parameters for ogr2ogr may need to be adjusted. Documents from esri are not consistent. --pawel On Sun, Nov 27, 2016 at 5:32 PM, Djordje Spasic <issworld2...@yahoo.com> wrote: > Hi Pawel, > > Thank you for the suggestion. > I am not familiar with subprocess.popen. > How would command line utility look like for this code: > > *import *clr > > iteropMapWinGIS_dll_filePath = "C:\\Program Files\\MapWindow GIS > Lite\\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(iteropMapWinGIS_dll_filePath) > *import *MapWinGIS > > > utils = MapWinGIS.*UtilsClass*() > osm_filePath = "C:\\rome.osm" > shps_filePath = "C:\\rome_sph_files" > bstrOptions = '--config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI > Shapefile"' > convertToShapefiles_Result = MapWinGIS.UtilsClass.*OGR2OGR*(utils, > osm_filePath, shps_filePath, bstrOptions, *None*) > *if *convertToShapefiles_Result == *False*: > *print *"MapWinGIS.UtilsClass.OGR2OGR failed the first time" > *print *utils.ErrorMsg > *print *utils.LastErrorCode > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorNo > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorMsg > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorType > *else*: > *print *"MapWinGIS.UtilsClass.OGR2OGR successfully ran the first time" > > > I would welcome any kind of further reply. > > Kind regards, > Djordje > > ----------------- > On Sunday, November 27, 2016 5:11 PM, Pawel Jasinski < > pawel.jasin...@gmail.com> wrote: > > From the API documentation, this is just an alternative entry point to > command line utility. > If the API does not behave, why not call the command line utility using > subprocess.popen ? > --pawel >
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users