Questions tagged [subprocess]

subprocess is a module of Python that can be used to implement multiprocessing

Filter by
Sorted by
Tagged with
1
vote
0answers
39 views

gdalcalc.py in Python 2.7 subprocess Popen - not spawning, nor any Exceptions

from subprocess import PIPE, CalledProcessError, Popen import subprocess import osgeo raster = '/home/rphillips/Desktop/tif_dir/merged.tif' raster_dir = os.path.dirname(raster) binary = raster_dir +...
1
vote
1answer
58 views

Calling `Rscript` from QGIS Python Console / QGIS Plugin not working

I want to run a RScript that plots some data which is fetched by a QGIS Plugin. However it returns a non zero-exist status and breaks (when running with subprocess.check_call) or just skips the ...
1
vote
0answers
220 views

Insert shp into existing Postgis table with python

I'm creating a Qgis python plugin that allows inserting shp into existing Postgis table, i've tried using ogr2ogr and it's workin when I run the command in FWTools Shell but when I try to run it in ...
2
votes
1answer
178 views

Call external programmes from python plugin in QGIS on windows

I need to call an external programme from python plugin in qgis, I didn't use os.systeme because I want to hide the launched programme with 'startupinfo.dwFlags |= subprocess._subprocess....
1
vote
0answers
158 views

Piping data between PostGIS 'raster2pgsql' and PostgreSQL using Python subprocess?

My goal is to create a system that will take a GeoTIFF format raster image and programmatically import it into a Postgres table using PostGIS raster2pgsql. In order to get this done with minimal ...
1
vote
1answer
573 views

Using Python Subprocess module to import shapefile into postgres

I am trying to use your mentioned code..but getting an error. The code used is mentioned below: import os import subprocess cmd = 'shp2pgsql -s 4326 E:\Forest\ForestFire\28052018\...
1
vote
1answer
86 views

Catching shp2psql errors from python's subprocess module

I'm importing data into postgresql with shp2psql and pyhton's subprocess module. command = 'shp2pgsql -s {SRID} -a -g geom -W "UTF-8" {SHP_path} {table_name} -I | ' \ 'psql -h {hostname} -p ...
0
votes
1answer
46 views

gdal_translate called via subprocess.check_output works when called directly, but not from within arcgis

EDIT: Solved it myself. Beginners error... :/ I am writing a python Toolbox that should use gdal_translate to convert an ASCII Gridded XYZ-File into a lower resolution (and doing afterwards a couple ...
2
votes
1answer
451 views

Using Python to send arguments to LAStools basics

I'm currently trying to develop a LAStools specific routine, setting all the parameters for lasheight then using the output of that to run lasclassify. The closest thing I've found to being able to ...
1
vote
1answer
143 views

Python subprocess.call gdaldem module

In python how do I subprocess.call the gdaldem module for color relief? In the command line I would type this: gdaldem color-relief path-to-raster path-to-colorfile path-to-destination-raster -alpha
2
votes
0answers
75 views

Create new Mapset with Python

I've tried to create a new Mapset/Location with Python for hours but I can't figure out how it works. The problem is that I can't use GRASS.SCRIPT because it already needs an existing Mapset and ...
2
votes
1answer
498 views

gdal_polygonize creating empty line file instead of polygon

I'm not sure what I'm doing wrong here. I suspect it is something simple and a duh moment. I'm just trying to get gdal_polygonize.py to make a polygon shapefile of a raster with a single value. It ...
4
votes
0answers
588 views

DLL load error calling 64 bit arcpy from subprocess

I have script that imports arcpy, then calls a python subprocess which also imports arcpy: call.py: import arcpy import subprocess cmd = [r'C:\Python27\ArcGISx6410.4\python', 'test.py'] ...
2
votes
2answers
2k views

mosaic rasters with gdal_merge.py

I want to mosaic 2 rasters "rasa" and "rasb" using gdal_merge.py . While running the code, it produces an error " No input files selected". Can somebody help me to find the error in the code? ...
4
votes
0answers
367 views

SQL SERVER 2012, Python subprocess, OGR [closed]

Need help with uploading shapefile with srid 102008 to SQL server 2012. I ran the ogr2ogr script in the ogr shell and it uploaded the shapefile within seconds but when I try using python subprocess to ...
1
vote
0answers
219 views

Pass information in external command line software from a python plugin file

it would be quite difficult to explain, I'll do my best.. I'm writing a plugin for QGIS (with the plugin builder, so the folder structure is straightforward). This plugin calls other software (that ...
1
vote
1answer
713 views

How to use subprocess module to run QGIS toolbox modules

I've been trying to use subprocess for a while now, but can't get it to work when calling QGIS modules. Here's my script: import subprocess call("processing.runalg('gdalogr:merge', [rasterin1,...
6
votes
0answers
285 views

Diminishing performance of gdal_polygonize in a python subprocess for GRASS to PostgreSQL [closed]

I have written a python script to polygonize GRASS rasters into a PostgreSQL database using the gdal utility gdal_polygonize: sub.call('gdal_polygonize.py -8 gdb/quercus/{0}/cellhd/{1} -f "PostgreSQL\...
1
vote
2answers
2k views

Use subprocess module to run GDAL processes

I am attempting to write a python script that will reproject & merge a series of .tif files then clip them to the boundaries of a .shp file. I have successfully used the subprocess module to do ...
1
vote
0answers
302 views

Reprojecting and Clipping in one script using Python Subprocess module and GDAL

I am trying to reproject a .tif file then clip it to the boundaries of a shapefile using GDAL Warp. I want to do this in a single script, and have successfully used the Python subprocess module to ...
2
votes
0answers
1k views

How to use Python's subprocess module in a for loop ArcGIS? [closed]

I am new to scripting with ArcGIS. Although this might be an easy thing for those that know Python well, I haven't figured out how to use the subprocess module in a script. I actually think I'm ...
3
votes
2answers
2k views

ArcPy script stops running randomly with no error returned

I am doing a batch watershed and analysis process on 135 points. This script worked great the first time I ran it. Ever since the first time, however, I have had the script stop at random moments. ...
1
vote
1answer
3k views

How to write output from subprocess to disk (using multiprocessing)

This code was developed from another question I posted about how to kill an arcpy tool if it takes longer than a specified time. See How to cancel tool execution in python. Using the multiprocssing ...
2
votes
0answers
167 views

Doesn’t cal AGSSOM program to manage AGS mapservices from python script

We are using ArcGISServer 10.0 on a windows server. Because of database management we need to stop several ArcGISServer Services. For this purpose I use the AGSSOM program, which is called from the ...
2
votes
0answers
221 views

Python scaling issues and possible subprocess conflicts? [closed]

I have always found such great analytical and programming expertise on StackExchange in the past that I hope you can help me. Background: I have a project that involves spatially joining and ...
1
vote
2answers
537 views

Using Python to execute Spatial Ecology GME commmands

I think I just need a second set of eyes on this. I'm just using Python to capture some user inputs to pass down to GME command. I'm only using the export to CSV to hammer out the behavior, but the ...
5
votes
1answer
909 views

How to implement multiprocessing with multiple geoprocesses?

I am relatively new to Python and thought I would give a stab at multiprocessing. I have a script that runs well in IDLE or as an ArcMap toolbox script. After perusing these forums and docs.python, I ...
6
votes
1answer
2k views

ArcGIS geoprocessor memory leak: what's the underlying cause and why is it so hard to fix? [closed]

@blah238's very nice answer to Porting Avenue code for Producing Building Shadows to ArcPy/Python for ArcGIS Desktop? reminded me of all the time I've spent over the past two years battling against ...
3
votes
1answer
616 views

Want to use GDAL in Arc10 toolbox via subprocess call

I'm attempting to launch a version Python 2.5 that supports GDAL from an ArcGIS10 toolbox script. I'm doing this because I'm having loads of trouble importing the GDAL library directly into Arc, and I'...