Pickling issue with python pathos -


import pathos.multiprocessing mp class model_output_file():     """     class read model output files     """     def __init__(self, ftype = ''):         """         constructor         """         # create sqlite database in analysis directory         self.db_name = 'sqlite:///' + constants.anly_dir + os.sep + ftype + '_' + '.db'         self.engine  = create_engine(self.db_name)         self.ftype   = ftype      def parse_dgn(self, fl):         df      = pandas.read_csv(...)         df.to_sql(self.db_name, self.engine, if_exists='append')      def collect_epic_output(self, fls):         pool = mp.processingpool(4)         if(self.ftype == 'dgn'):             pool.map(self.parse_dgn, fls)         else:             logging.info( 'wrong file type')  if __name__ == '__main__':     list_fls = fnmatch.filter(...)     obj = model_output_file(ftype = 'dgn')     obj.collect_model_output(list_fls) 

in code above, using pathos multiprocessing library avoid python multiprocessing issues classes. getting pickling error:

  pool.map(self.parse_dgn, fls)   file "c:\anaconda64\lib\site-packages\pathos-0.2a1.dev0-py2.7.egg\pathos\multiprocessing.py", line 131, in map     return _pool.map(star(f), zip(*args)) # chunksize   file "c:\anaconda64\lib\multiprocessing\pool.py", line 251, in map     return self.map_async(func, iterable, chunksize).get()   file "c:\anaconda64\lib\multiprocessing\pool.py", line 567, in     raise self._value cpickle.picklingerror: can't pickle <type 'function'>: attribute lookup __builtin__.function failed 

how fix this?

i'm pathos author. getting cpickle.picklingerror… should not pathos. make sure have multiprocess installed, , if do, have c++ compiler. can check pickling errors importing dill, , doing dill.copy(self.parse_dgn) inside class, or externally using instance of class. if works, have installation issue, pathos finding python standard library multiprocessing. if so, need install compiler… microsoft visual studio community. see: github.com/mmckerns/tuthpc. make sure rebuild multiprocess after install of ms compiler.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -