Skip to content
Advertisement

AttributeError: Can’t get attribute ‘journalerReader’ on <module '__mp_main__

I tried to implement Lmax in python .I tried to handle data in 4 processes

JavaScript

but I get this Error in my code :

JavaScript

Advertisement

Answer

Your first problem is that the target of a Process call cannot be within the if __name__ == '__main__': block. But:

As I mentioned in an earlier post of yours, the only way I see that you can share an instance of CircularBuffer across multiple processess is to implement a managed class, which surprisingly is not all that difficult to do. But when you create a managed class and create an instance of that class, what you have is actually a proxy reference to the object. This has two implications:

  1. Each method call is more like a remote procedure call to a special server process created by the manager you will start up and therefore has more overhead than a local method call.
  2. If you print the reference, the class’s __str__ method will not be called; you will be printing a representation of the proxy pointer. You should probably rename method __str__ to something like dump and call that explicitly whenever you want a representation of the instance.

You should also explicitly wait for the completion of the processes you are creating so that the manager service does not shutdown prematurely, which means that each process should be assigned to a unique variable and have a unique name.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement