Tuesday, 15 September 2015

python - Why do I get a "Can't pickle ..." when I try to run a function and kill it if it timeouts? -



python - Why do I get a "Can't pickle ..." when I try to run a function and kill it if it timeouts? -

first of allow me tell i'm kind of newb @ threads , multiprocessing.

i've got python graphical programme 1 time take translation site , click button, calls thread open browser , search on given site (i'm using splinter, uses selenium, , qt graphical part) of terms located in text file selected user.

i'm trying timeout search of each term on site 30 seconds, because there loading problems, or other issues, , want able skip term if takes time search , seek @ later time.

so: have code on event handler of button:

self.searchthread = pesquisathread() self.searchthread.start()

then @ run method of thread have:

glossary.do_search(0, site_to_look_for)

'glossary' class of gui.

then if glossary translib selected 'do_search' does:

search_translib(language_from,language_to)

which calls function opening of browser , clicking of links, etc, so...

p = multiprocessing.process(target=search_term_language,args=(browser,'portuguese', row, column,termo_unicode)) p.start() p.join(30)

but when particular code runs get:

pickle.picklingerror: can't pickle '_subprocess_handle' object: <_subprocess_handle object @ 0x0230da60>

i'm @ loss, know going on.

thank daniel

python multithreading timeout

No comments:

Post a Comment