python - Python3: Shared Array with strings between processes -


i want share list strings between processes, unfortunately receive error message "valueerror: character u+169ea10 not in range [u+0000; u+10ffff]".

here python 3 code:

from multiprocessing import process, array, lock ctypes import c_wchar_p import time  def run_child(a):     time.sleep(2)     print(a[0]) # print foo     print(a[1]) # print bar     print(a[2]) # print baz     print("set foofoo barbar bazbaz")     a[0] = "foofoo"     a[1] = "barbar"     a[2] = "bazbaz"  lock = lock() = array(c_wchar_p, range(3), lock=lock) p = process(target=run_child, args=(a,)) p.start()  print("set foo bar baz") a[0] = "foo" a[1] = "bar" a[2] = "baz"  time.sleep(4)  print(a[0]) # print foofoo print(a[1]) # print barbar print(a[2]) # print bazbaz 

does knows doing wrong?

regards jonny

your ctype doesn't match content of array. initializing data should list of strings match ctype you're specifying. you're initializing range(3), evaluates integers, not strings.

should more like

a = array(c_wchar_p, ('', '', ''), lock=lock) 

from docs

c_wchar_p

represents c wchar_t * datatype, must pointer zero-terminated wide character string. constructor accepts integer address, or string.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -