1

I have a series of related python multiprocessing problems that I, regrettably, am having a hard time describing.

I have instantiated a starmap execution of my functions within a multiprocessing pool.I have a fairly long script that calls multiprocessing for file parsing. Everything runs smoothly within the if name==main block where I call the multiprocessing pool.

However, anywhere within my main script, it is as if the created process tries to run through my entire script without any data or variable creation, and thus it outputs many exceptions:

    return load_source(name, filename, file)
  File "C:\Python33\lib\imp.py", line 114, in load_source
    return _LoadSourceCompatibility(name, pathname, file).load_module(name)
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 869, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "C:\Users\pdalach\Documents\Visual Studio 2010\Projects\ChimeraPythonSupp

Forgive me for my inexact question...I am wrestling to put words to the problem. I am entirely new to python.

Thank you.

PaulD
  • 615
  • 1
  • 8
  • 15
  • Can you post some example code? Is everything in a single file or are you importing multiple files? Normally I try to put everything into classes and then in the "if __name__ == "__main__:" block I instantiate those classes. – hyprnick May 01 '13 at 23:15
  • 3
    This question has been asked many times. The reasoning for why this occurs can be found here: http://stackoverflow.com/a/2697679/824544 In short, on Windows, the script will constantly be importing itself in an infinite loop. – Anorov May 01 '13 at 23:15
  • Anorov...you are quite right. I actually previously saw your linked post. I mistakenly thought that only multiprocessing commands (e.g. pool, queue, etc.) were supposed to be within the __name__==__main__ block. Now I better understand how the multiprocessing is being implemented...I need to put my entire script within the if block. – PaulD May 02 '13 at 01:09

0 Answers0