I have a script which requires multiprocessing. What I found from this script is that there is a problem with the multiprocessing module. To test this theory, I copied and pasted
from multiprocessing import Process
def f(name):
print('hello', name)
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
p.join()
into a test script and received the following traceback
Traceback (most recent call last):
File "a.py", line 1, in <module>
from multiprocessing import Process
File "/usr/lib64/python3.3/multiprocessing/__init__.py", line 40, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/usr/lib64/python3.3/multiprocessing/util.py", line 16, in <module>
import threading # we want threading to install it's
File "/usr/lib64/python3.3/threading.py", line 11, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib64/python3.3/traceback.py", line 3, in <module>
import linecache
File "/usr/lib64/python3.3/linecache.py", line 10, in <module>
import tokenize
File "/usr/lib64/python3.3/tokenize.py", line 30, in <module>
from token import *
File "/home/lucas/Server/ClinApp/weblabs/utils/token.py", line 1, in <module>
from django.conf import settings
File "/usr/lib/python3.3/site-packages/django/conf/__init__.py", line 9, in <module>
import logging
File "/usr/lib64/python3.3/logging/__init__.py", line 195, in <module>
_lock = threading.RLock()
AttributeError: 'module' object has no attribute 'RLock'
Also, I am running fedora 18 64-bit on a quad core ivy bridge. Why am I receiving this traceback error?
Here is what happens when I run RLock
$ python3
>>> import threading
>>> threading.RLock()
<_thread.RLock owner=0 count=0>
>>>
File "/usr/lib64/python3.3/tokenize.py", line 30, in <module>
from token import *
File "/home/lucas/Server/ClinApp/weblabs/utils/token.py", line 1, in <module>
from django.conf import settings
Your /home/lucas/Server/ClinApp/weblabs/utils/token.py script is being imported instead of the standard python 'token.py'. Its got a bug in it or it simply shouldn.t be imported as a top level script. You probably have /home/lucas/Server/ClinApp/weblabs/utils/ in your python path in some way.
Generally, its not a good idea to name python scripts after builtin scripts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With