Skip to content

Instantly share code, notes, and snippets.

@pyokagan
Created June 10, 2012 03:13
Show Gist options
  • Select an option

  • Save pyokagan/2903714 to your computer and use it in GitHub Desktop.

Select an option

Save pyokagan/2903714 to your computer and use it in GitHub Desktop.
Pickling in multiprocessing causing bug
---------------------------------------------------------------------------
PicklingError Traceback (most recent call last)
C:\Users\pyokagan\<ipython-input-5-846925efa119> in <module>()
9 #Wrap all Client Credentials!
10 cwrap.wrap_authorization_server_database(context.authorization_servers, client_db)
---> 11 args.func(args)
C:\Users\pyokagan\<ipython-input-2-7bd01ceccacc> in authcode(args)
19 redirect_uri = args.redirect_uri
20 req = gen(None, redirect_uri = redirect_uri, scope = scope)
---> 21 grant = req().grant
22 #print(req.uri)
23 #redirected_url = input('Redirected URL: ')
C:\Users\pyokagan\AppData\Roaming\Python\Python32\site-packages\pykoauth2\specialredirecturis\localhost.py in call(self)
87 parent_pipe, child_pipe = Pipe()
88 httpd_p = Process(target = run_server, args = (child_pipe, port))
---> 89 httpd_p.start()
90 #Web Server Started. Now launch web browser...?
91 #For now, print URL
C:\Python32\lib\multiprocessing\process.py in start(self)
130 else:
131 from .forking import Popen
--> 132 self._popen = Popen(self)
133 _current_process._children.add(self)
134
C:\Python32\lib\multiprocessing\forking.py in __init__(self, process_obj)
266 try:
267 dump(prep_data, to_child, HIGHEST_PROTOCOL)
--> 268 dump(process_obj, to_child, HIGHEST_PROTOCOL)
269 finally:
270 del Popen._tls.process_handle
C:\Python32\lib\multiprocessing\forking.py in dump(obj, file, protocol)
188
189 def dump(obj, file, protocol=None):
--> 190 ForkingPickler(file, protocol).dump(obj)
191
192 #
C:\Python32\lib\pickle.py in dump(self, obj)
235 if self.proto >= 2:
236 self.write(PROTO + bytes([self.proto]))
--> 237 self.save(obj)
238 self.write(STOP)
239
C:\Python32\lib\pickle.py in save(self, obj, save_persistent_id)
342
343 # Save the reduce() output and finally memoize the object
--> 344 self.save_reduce(obj=obj, *rv)
345
346 def persistent_id(self, obj):
C:\Python32\lib\pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
430
431 if state is not None:
--> 432 save(state)
433 write(BUILD)
434
C:\Python32\lib\pickle.py in save(self, obj, save_persistent_id)
297 f = self.dispatch.get(t)
298 if f:
--> 299 f(self, obj) # Call unbound method with explicit self
300 return
301
C:\Python32\lib\pickle.py in save_dict(self, obj)
621
622 self.memoize(obj)
--> 623 self._batch_setitems(obj.items())
624
625 dispatch[dict] = save_dict
C:\Python32\lib\pickle.py in _batch_setitems(self, items)
654 for k, v in tmp:
655 save(k)
--> 656 save(v)
657 write(SETITEMS)
658 elif n:
C:\Python32\lib\pickle.py in save(self, obj, save_persistent_id)
297 f = self.dispatch.get(t)
298 if f:
--> 299 f(self, obj) # Call unbound method with explicit self
300 return
301
C:\Python32\lib\pickle.py in save_global(self, obj, name, pack)
681 raise PicklingError(
682 "Can't pickle %r: it's not found as %s.%s" %
--> 683 (obj, module, name))
684 else:
685 if klass is not obj:
PicklingError: Can't pickle <function run_server at 0x00000000040717C8>: it's not found as pykoauth2.specialredirecturis.localhost.run_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment