Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14126

Python proccess not start via block input

$
0
0

Minimal code for test. If clear # time.sleep(0.5) to add function not started in other proccess.How do without time.sleep

import multiprocessingimport timedef add(counter):    while 1:        print(counter.value)        counter.value += 1        time.sleep(1)if __name__ == '__main__':    counter = multiprocessing.Value('i', 0)    t = multiprocessing.Process(target=add, args=(counter,))    t.start()    #  time.sleep(0.5)    input("blocking...")

I expected: 0 1 2 and etc. But i get blocking...

Update:
Works in the console. If you run it through Pycharm windows, the proccess is blocked.settings_pycharm.png


Viewing all articles
Browse latest Browse all 14126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>