![]() The solution is not to invoke () for each iteration. This isn't a bug in grass.pipe_command (etc) you would have exactly the same problem if you invoked subprocess.Popen() (or os.system(), or any other interface for executing commands). ![]() So those variables' values get larger with each iteration. ![]() That function appends the GRASS-specific directories to PATH, LD_LIBRARY_PATH (or equivalent) and PYTHONPATH, even if they're already present. This is caused by calling () for each iteration. In this case, it's the environment which is too large, not the argument list. The number of bytes used by the new process image's argument list and environment list is greater than the system-imposed limit of bytes. ![]() The error message (which comes from strerror) is misleading. 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)ġ326 child_exception = pickle.loads(data) 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)ħ12 # Preserve original exception in case os.close raises. 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) usr/lib/grass64/etc/python/grass/script/core.pyc in start_command(prog, flags, overwrite, quiet, verbose, **kwargs) > 215 return start_command(*args, **kwargs) usr/lib/grass64/etc/python/grass/script/core.pyc in pipe_command(*args, **kwargs) > 29 process = grass.pipe_command(cmd, **kwargs)ģ0 stdout, stderr = municate() tmp/grass_demo.py in export(loc, name, out_fn) > 42 export(loc_name, rast_name, out_fn) OSError Traceback (most recent call last)Ĥ1 out_fn = os.path.join(work_dir, 'rast.tif') When running grass.pipe_command many times in a row, I get:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |