Error: .py file versus interactive

I hope this post is rightly placed here…
I have starfted with fastai and executed the following command in the python shell:

from import *
from fastai.callbacks.one_cycle import *
path = untar_data(URLs.MNIST_SAMPLE)
data = ImageDataBunch.from_folder(path)
model = simple_cnn((3,16,16,2))
learn = Learner(data, model)

It works fine in the python shell, but when I copy it into a file and call python I get an error when starts.

     File “C:\Program Files\Python37\lib\multiprocessing\”, line 136, in _check_not_importing_main
     is not going to be frozen to produce an executable.’’’)
     An attempt has been made to start a new process before the
     current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I do not understand why I can run code interactively but not as a python file
Ciao, mathias


aparently, this is related to fastai trying to use multiple workers which my CTX1660 does not support.
Is there a way to tell fastai to use num_worker=0 ?

Ciao, Mathias

I changed

data = ImageDataBunch.from_folder(path)


data = ImageDataBunch.from_folder(path, num_workers=0)

and it works
Ciao, Mathias