Closed jmrohwer closed 7 years ago
Breaks multiprocessing (and thus parallel scanning) as well:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 326, in _handle_workers
pool._maintain_pool()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 230, in _maintain_pool
self._repopulate_pool()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 223, in _repopulate_pool
w.start()
File "/usr/lib/python2.7/multiprocessing/process.py", line 130, in start
self._popen = Popen(self)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 125, in __init__
random.seed()
File "/usr/lib/python2.7/random.py", line 118, in seed
super(Random, self).seed(a)
NameError: global name 'Random' is not defined
Aargh I forgot about this import module irritation. The best would probably be to kill of the masking, which to be honest, I didn't like anyway
OK are you going to fix and commit?
Done, sometimes Python's referencing drives me nuts. This is simply so people don't use unparseable stuff in the input file so is not so important, you'll just get a parse error which is ok.
Actually, seeing as this is all just Python I can create a PySCeS version of random that only has the funcitons I want in it and import that, then we should be fine.
Ok I implemented the above, this shouldn't interfere with the standard modules
This (PyscesModel.py lines 53-58)
is a very bad idea. For example, it breaks the latest IPython console, which relies on random.shuffle:
Any better ways to fix it? (The jupyter notebook still works fine, but generally it is a bad, bad idea to delete functions from python core modules.