[GRASS-dev] [GRASS GIS] #2468: Python OSError: [Errno 7] Argument list too long when running grass.pipe_command repeatedly

GRASS GIS trac at osgeo.org
Fri Oct 31 13:30:59 PDT 2014


#2468: Python OSError: [Errno 7] Argument list too long when running
grass.pipe_command repeatedly
---------------------------------------------------+------------------------
 Reporter:  maxnova                                |       Owner:  grass-dev@…              
     Type:  defect                                 |      Status:  new                      
 Priority:  normal                                 |   Milestone:  6.4.5                    
Component:  Python                                 |     Version:  6.4.4                    
 Keywords:  OSError, pipe_command, python, script  |    Platform:  Linux                    
      Cpu:  x86-64                                 |  
---------------------------------------------------+------------------------
 Code to replicate here: https://gist.github.com/max-
 nova/5cd876bc7bfefe5b7c9e

 Running on:
 {{{
 lsb_release -a
 Distributor ID: Ubuntu
 Description:    Ubuntu 14.04.1 LTS
 Release:        14.04
 Codename:       trusty

 uname -a
 Linux 35d9d88be0b6 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC
 2014 x86_64 x86_64 x86_64 GNU/Linux
 }}}

 When running grass.pipe_command many times in a row, I get:

 {{{
 ...
 Iteration 2843
 Iteration 2844
 Iteration 2845
 Iteration 2846
 Iteration 2847
 Iteration 2848
 ---------------------------------------------------------------------------
 OSError                                   Traceback (most recent call
 last)
 <ipython-input-2-094d639353cc> in <module>()
 ----> 1 grass_demo.run()

 /tmp/grass_demo.py in run()
      40
      41         out_fn = os.path.join(work_dir, 'rast.tif')
 ---> 42         export(loc_name, rast_name, out_fn)
      43
      44         shutil.rmtree(work_dir)

 /tmp/grass_demo.py in export(loc, name, out_fn)
      27         'output': out_fn
      28     }
 ---> 29     process = grass.pipe_command(cmd, **kwargs)
      30     stdout, stderr = process.communicate()
      31

 /usr/lib/grass64/etc/python/grass/script/core.pyc in pipe_command(*args,
 **kwargs)
     213     """
     214     kwargs['stdout'] = PIPE
 --> 215     return start_command(*args, **kwargs)
     216
     217 def feed_command(*args, **kwargs):

 /usr/lib/grass64/etc/python/grass/script/core.pyc in start_command(prog,
 flags, overwrite, quiet, verbose, **kwargs)
     175         sys.stderr.flush()
     176
 --> 177     return Popen(args, **popts)
     178
     179 def run_command(*args, **kwargs):

 /usr/lib/grass64/etc/python/grass/script/core.pyc in __init__(self, args,
 bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell,
 cwd, env, universal_newlines, startupinfo, creationflags)
      54                                   preexec_fn, close_fds, shell,
      55                                   cwd, env, universal_newlines,
 ---> 56                                   startupinfo, creationflags)
      57
      58 PIPE = subprocess.PIPE

 /usr/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize,
 executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env,
 universal_newlines, startupinfo, creationflags)
     708                                 p2cread, p2cwrite,
     709                                 c2pread, c2pwrite,
 --> 710                                 errread, errwrite)
     711         except Exception:
     712             # Preserve original exception in case os.close raises.

 /usr/lib/python2.7/subprocess.pyc in _execute_child(self, args,
 executable, preexec_fn, close_fds, cwd, env, universal_newlines,
 startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread,
 c2pwrite, errread, errwrite)
    1325                         raise
    1326                 child_exception = pickle.loads(data)
 -> 1327                 raise child_exception
    1328
    1329

 OSError: [Errno 7] Argument list too long
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2468>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list