MatthewHiggins2017 / bioconda-PrimedRPA

GNU General Public License v3.0
19 stars 24 forks source link

Fix for UnboundLocalError #8

Open drawlerr opened 2 years ago

drawlerr commented 2 years ago

In modern versions of Python 3, the multiprocessing library calls forked modules __mp_main instead of main, so mid-function if name == main__ checks failed, causing the following code to reference an undefined variable.

I believe this check should have always been outside function-scope, so I have moved it to the top level before function invocation to fix all instances of this problem.

drawlerr commented 2 years ago

Fixes #7

maxwett commented 2 years ago

Hi, Thank you for the fix it adress the exact problem i am facing ! But I am having trouble installing it , i uninstalled the old version and reinstalled the new version by running the setup.py but i get the following error:

Generating Alignment Summary Traceback (most recent call last): File "/Users/maximilianwettstein/opt/anaconda3/bin/PrimedRPA", line 4, in import('pkg_resources').run_script('primedrpa==1.0.0', 'PrimedRPA') File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/site-packages/pkg_resources/init.py", line 651, in run_script self.require(requires)[0].run_script(script_name, ns) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/site-packages/pkg_resources/init.py", line 1455, in run_script exec(script_code, namespace, namespace) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/site-packages/primedrpa-1.0.0-py3.9.egg/EGG-INFO/scripts/PrimedRPA", line 1044, in File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/site-packages/primedrpa-1.0.0-py3.9.egg/EGG-INFO/scripts/PrimedRPA", line 804, in CheckingAlignedOutputFile File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/context.py", line 119, in Pool return Pool(processes, initializer, initargs, maxtasksperchild, File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/pool.py", line 212, in init self._repopulate_pool() File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/pool.py", line 303, in _repopulate_pool return self._repopulate_pool_static(self._ctx, self.Process, File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/pool.py", line 326, in _repopulate_pool_static w.start() File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/process.py", line 121, in start self._popen = self._Popen(self) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in init super().init(process_obj) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/popen_fork.py", line 19, in init self._launch(process_obj) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 42, in _launch prep_data = spawn.get_preparation_data(process_obj._name) File "/Users/maximilianwettstein/opt/anaconda3/lib/python3.9/multiprocessing/spawn.py", line 183, in get_preparation_data main_mod_name = getattr(main_module.spec, "name", None) AttributeError: module 'main' has no attribute 'spec'

Did anyone have the same error or did I install it the wrong way?