yellowedhare
yellowedhare

Reputation: 77

Python multiprocessing not calling function

I'm trying to get this code to work, and it looks like update isn't getting called. Nothing is printed to the console with this code, why?

from multiprocessing import Process

def update():
    print("hi")

if __name__ == '__main__':
    p = Process(target=update, args=())
    p.start()
    p.join()

Upvotes: 2

Views: 3657

Answers (2)

ErvingGoffman
ErvingGoffman

Reputation: 189

Sorry for the stupid answer, but maybe you do not have time to see the output in stdout? Try running the script from the command line, like this: c:\<script location>\script.py

UPD: riscnotcisc said true.

Upvotes: 0

pointerless
pointerless

Reputation: 753

Run your program from the command line, python idle doesn't deal with this correctly as detailed here

Upvotes: 3

Related Questions