[GRASS-user] Python 3 Error using MultiModule and ParallelModuleQueue

Hello,

I try to write a GRASS addon, which does some preprocessing and classifies with r.learn.ml on different region parallel. For this, I want to use MultiModule and ParallelModuleQueue.

I tested the examples on https://grass.osgeo.org/grass77/manuals/libpython/pygrass.modules.interface.html?highlight=parallelmodulequeue#pygrass.modules.interface.module.ParallelModuleQueue with Python 3.

The example “Check MultiModule approach with three by two processes running in a background process” leads to

...

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/queues.py", line 235, in _feed
obj = _ForkingPickler.dumps(obj)
File "/usr/lib/python3.6/multiprocessing/reduction.py", line 52, in dumps
cls(buf, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects

...

The same error appears in the MultiModule example “Asynchronous module run, setting finish = False and using temporary region”.

Using python 2 all works fine.

Has someone a solution for the error or an idea how I can write a Grass addon with parallelization on different regions?

Thanks and best regards,

Anika

P.S. I used this versions on Linux Mint 19 Tara:

python3 --version
Python 3.6.7

python --version
Python 2.7.15rc1

grass77 --config svn_revision version
74074M
7.7.svn

···
-- 
 
  Anika Bettge
  - Anwendungsentwicklerin -

  mundialis GmbH & Co. KG
  Kölnstraße 99
  53111 Bonn

  Tel: +49 (0)228 / 38 75 80 -80
  Fax: +49 (0)228 / 96 28 99 -57

  Email: [bettge@mundialis.de](mailto:bettge@mundialis.de)
  Web: [https://www.mundialis.de](https://www.mundialis.de)

  Amtsgericht Bonn, HRA 8528
  Komplementärin: mundialis Verwaltungsgesellschaft mbH
  vertreten durch: Dr. Markus Neteler, Hinrich Paulsen, Till Adams
  
  Informationen über Ihre gespeicherten Daten finden Sie auf unserer Homepage unter folgendem Link: 
  [https://www.mundialis.de/datenschutzerklaerung](https://www.mundialis.de/datenschutzerklaerung)