yet another confusion with multiprocessing error, 'module' object has no attribute 'f'

前端 未结 5 1421
滥情空心
滥情空心 2020-11-28 07:53

I know this has been answered before, but it seems that executing the script directly \"python filename.py\" does not work. I have Python 2.6.2 on SuSE Linux.

Code:<

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 08:33

    One possibility is that your python file has the same name as a module:

    • test.py
    • test/
      • __init__.py

    in pickle.py, you have the error coming from:

        def find_class(self, module, name):
          # Subclasses may override this
          __import__(module)
          mod = sys.modules[module] # <- here mod will reference your test/__init__.py
          klass = getattr(mod, name)
          return klass
    

提交回复
热议问题