Python Module Import, differences on Windows and Linux -
i have wrapper function puts results of generic parsefunction queue
def parse_threaded(parsefunction, response_q, parsed_q, stop_event): while not (stop_event.is_set() , response_q.empty()): if response_q.qsize() > 0: response = response_q.get() parsed = parsefunction(response) response_q.task_done() if parsed: parsed_q.put(parsed)
the parse functions, passed argument imported different module with
import parser
these parse functions may later passed following code
beer_parse_worker = threading.thread(target=parse_threaded, args=(parse_beer, beer_response_q, beer_q,stop_beer_parse_worker)) beer_parse_worker.start()
as can see pass parse function (parse_beer) argument, works on windows python 3.5, on linux same python version need following code:
beer_parse_worker = threading.thread(target.parse_threaded, args=(parser.parse_beer, beer_response_q, beer_q,stop_beer_parse_worker)) beer_parse_worker.start()
so in linux need refer function qualified name, parser.parse_beer , in windows needs parse_beer
anybody has idea why happens? thanks
Comments
Post a Comment