After running the codes provided in the tutorial of justpy
import justpy as jp
def my_click(self, msg):
self.text = 'I was clicked'
def event_demo():
wp = jp.WebPage()
d = jp.Div(text='Not clicked yet', a=wp, classes='w-48 text-xl m-2 p-1 bg-blue-500 text-white')
d.on('click', my_click)
return wp
jp.justpy(event_demo)
I received the following errors whenever I opening the webpage on 127.0.0.1:8000. The layout of the webpage can be rendered properly, but the events of the elements cannot, i.e. the element can't be clicked.
JustPy ready to go on http://127.0.0.1:8000
ERROR base_events: Exception in callback _ProactorReadPipeTransport._loop_reading(<_OverlappedF...bits\r\n\r\n'>)
handle: <Handle _ProactorReadPipeTransport._loop_reading(<_OverlappedF...bits\r\n\r\n'>)>
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 318, in _loop_reading
self._data_received(data)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 269, in _data_received
self._protocol.data_received(data)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 124, in data_received
self.handle_events()
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 173, in handle_events
self.handle_upgrade(event)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 245, in handle_upgrade
protocol = self.ws_protocol_class(
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 62, in __init__
super().__init__(
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\legacy\server.py", line 201, in __init__
super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'logger'
May I ask why it happens and how it can be solved? Thanks for your patience and sorry for my bad English.
Related
i have a problem:
This is the run function after I click on the kivy button
And I know that time.sleep is used badly here, but how can I possibly
replace it?
from jnius import autoclass
def run(self):
self.r = MyRecorder()
self.r.mRecorder.prepare()
self.r.mRecorder.start()
self.console.text += "Recording.."
time.sleep(1)
self.r.mRecorder.stop()
self.r.mRecorder.release()
self.console.text += "Recording stopped.."
This is the recorder class (Is everything right?)
class MyRecorder:
def __init__(self):
'''Recorder object To access Android Hardware'''
self.MediaRecorder = autoclass('android.media.MediaRecorder')
self.AudioSource = autoclass('android.media.MediaRecorder$AudioSource')
self.OutputFormat = autoclass('android.media.MediaRecorder$OutputFormat')
self.AudioEncoder = autoclass('android.media.MediaRecorder$AudioEncoder')
# create out recorder
self.mRecorder = self.MediaRecorder()
self.mRecorder.setAudioSource(self.AudioSource.MIC)
self.mRecorder.setOutputFormat(self.OutputFormat.THREE_GPP)
self.mRecorder.setAudioEncoder(self.AudioEncoder.AMR_NB)
self.mRecorder.setOutputFile('./MYAUDIO.3gp')
Here's the error I got:
if child.dispatch('on_touch_down', touch): File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/kivy/uix/behaviors/button.py", line 151, in on_touch_down
self.dispatch('on_press') File "kivy/_event.pyx", line 705, in kivy._event.EventDispatcher.dispatch File "kivy/_event.pyx", line 1248, in kivy._event.EventObservers.dispatch File "kivy/_event.pyx", line 1132, in kivy._event.EventObservers._dispatch File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/kivy/lang/builder.py", line 57, in custom_callback
exec(kvlang.co_value, idmap) File "/storage/emulated/0/python/my.kv", line 6, in <module>
on_press: root.run() File "/storage/emulated/0/python/main.py", line 51, in run
startRecording(self) File "/storage/emulated/0/python/main.py", line 139, in init
self.mRecorder.setOutputFile('./MYAUDIO.3gp') File "jnius/jnius_export_class.pxi", line 857, in jnius.jnius.JavaMethod.call File "jnius/jnius_export_class.pxi", line 954, in jnius.jnius.JavaMethod.call_method File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception jnius.jnius.JavaException: JVM exception occurred: setAudioSource failed. java.lang.RuntimeException
Can anyone help me please? Thanks!
I don't have a lot of experience in Kivy, but based on my experience developing some native android Apps, looks like you didn't ask for record audio permission on your code.
Based on this video (start on 27:48), you need to request access putting on your code something like:
from android.permissions import Permission, request_permissions
def callback_func(permission, results):
if all([res for res in results):
print("All permissions granted")
else:
print("Did not get all permissions")
request_permissions([Permission.RECORD_AUDIO], callback_func)
Remember to ask for the record permission BEFORE using the microphone.
You can read all the permissions here.
Code Example
#client.event
async def on_reaction_add(reaction, user):
channel = reaction.message.channel
if reaction.emoji == '🇪🇸':
translaty = translator.translate(
str(reaction.message.content), lang_tgt='es')
await channel.send("Translating {}'s message: {}".format(str(reaction.message.author)[:-5], reaction.message.content))
await channel.send("`" + str(translaty) + "`")
The current code was working however i am not getting the following error.
Ignoring exception in on_reaction_add
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Dell\Desktop\discordbotpy\bot.py", line 29, in on_reaction_add
translaty = translator.translate(
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\google_trans_new\google_trans_new.py", line 188, in translate
raise e
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\google_trans_new\google_trans_new.py", line 152, in translate
response = json.loads(response)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 970 (char 969)
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001D99233E040>
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
Any help would be greatly appreciated, my mind has just gone blank and cannot seem to work it out. As I stated above this worked about 1 week ago and i have not touched the code since, but now I just get the above error.
I think you're suffering from an unfortunate error with the google translate library you're using to translate the message.
Had a quick look online and someone's already posted a workaround here
I am trying to use Azure Service Bus as the broker for my celery app.
I have patched the solution by referring to various sources.
The goal is to use Azure Service Bus as the broker and PostgresSQL as the backend.
I created an Azure Service Bus and copied the credentials for the RootManageSharedAccessKey to the celery app.
Following is the task.py
from time import sleep
from celery import Celery
from kombu.utils.url import safequote
SAS_policy = safequote("RootManageSharedAccessKey") #SAS Policy
SAS_key = safequote("1234222zUY28tRUtp+A2YoHmDYcABCD") #Primary key from the previous SS
namespace = safequote("bluenode-dev")
app = Celery('tasks', backend='db+postgresql://afsan.gujarati:admin#localhost/local_dev',
broker=f'azureservicebus://{SAS_policy}:{SAS_key}=#{namespace}')
#app.task
def divide(x, y):
sleep(30)
return x/y
When I try to run the Celery app using the following command:
celery -A tasks worker --loglevel=INFO
I get the following error
[2020-10-09 14:00:32,035: CRITICAL/MainProcess] Unrecoverable error: AzureHttpError('Unauthorized\n<Error><Code>401</Code><Detail>claim is empty or token is invalid. TrackingId:295f7c76-770e-40cc-8489-e0eb56248b09_G5S1, SystemTracker:bluenode-dev.servicebus.windows.net:$Resources/Queues, Timestamp:2020-10-09T20:00:31</Detail></Error>')
Traceback (most recent call last):
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/transport/virtual/base.py", line 918, in create_channel
return self._avail_channels.pop()
IndexError: pop from empty list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/azure/servicebus/control_client/servicebusservice.py", line 1225, in _perform_request
resp = self._filter(request)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/azure/servicebus/control_client/_http/httpclient.py", line 211, in perform_request
raise HTTPError(status, message, respheaders, respbody)
azure.servicebus.control_client._http.HTTPError: Unauthorized
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/worker/worker.py", line 203, in start
self.blueprint.start(self)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
step.start(parent)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/bootsteps.py", line 365, in start
return self.obj.start()
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 311, in start
blueprint.start(self)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
step.start(parent)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/worker/consumer/connection.py", line 21, in start
c.connection = c.connect()
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 398, in connect
conn = self.connection_for_read(heartbeat=self.amqheartbeat)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 404, in connection_for_read
return self.ensure_connected(
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 430, in ensure_connected
conn = conn.ensure_connection(
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/connection.py", line 383, in ensure_connection
self._ensure_connection(*args, **kwargs)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/connection.py", line 435, in _ensure_connection
return retry_over_time(
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/utils/functional.py", line 325, in retry_over_time
return fun(*args, **kwargs)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/connection.py", line 866, in _connection_factory
self._connection = self._establish_connection()
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/connection.py", line 801, in _establish_connection
conn = self.transport.establish_connection()
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/transport/virtual/base.py", line 938, in establish_connection
self._avail_channels.append(self.create_channel(self))
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/transport/virtual/base.py", line 920, in create_channel
channel = self.Channel(connection)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/kombu/transport/azureservicebus.py", line 64, in __init__
for queue in self.queue_service.list_queues():
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/azure/servicebus/control_client/servicebusservice.py", line 313, in list_queues
response = self._perform_request(request)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/azure/servicebus/control_client/servicebusservice.py", line 1227, in _perform_request
return _service_bus_error_handler(ex)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/azure/servicebus/control_client/_serialization.py", line 569, in _service_bus_error_handler
return _general_error_handler(http_error)
File "/Users/afsan.gujarati/.pyenv/versions/3.8.1/envs/celery-servicebus/lib/python3.8/site-packages/azure/servicebus/control_client/_common_error.py", line 41, in _general_error_handler
raise AzureHttpError(message, http_error.status)
azure.common.AzureHttpError: Unauthorized
<Error><Code>401</Code><Detail>claim is empty or token is invalid. TrackingId:295f7c76-770e-40cc-8489-e0eb56248b09_G5S1, SystemTracker:bluenode-dev.servicebus.windows.net:$Resources/Queues, Timestamp:2020-10-09T20:00:31</Detail></Error>
I don't see a straight solution for this anywhere. What am I missing?
P.S. I did not create the Queue in Azure Service Bus. I am assuming that celery would create the Queue by itself when the celery app is executed.
P.S.S. I also tried to use the exact same credentials in Python's Service Bus Client and it seemed to work. It feels like a Celery issue, but I am not able to figure out exactly what.
If you want to use Azure Service Bus Transport to connect Azure service bus, the URL should be azureservicebus://{SAS policy name}:{SAS key}#{Service Bus Namespace}.
For example
Get Shared access policies RootManageSharedAccessKey
Code
from celery import Celery
from kombu.utils.url import safequote
SAS_policy = "RootManageSharedAccessKey" # SAS Policy
# Primary key from the previous SS
SAS_key = safequote("X/*****qyY=")
namespace = "bowman1012"
app = Celery('tasks', backend='db+postgresql://<>#localhost/<>',
broker=f'azureservicebus://{SAS_policy}:{SAS_key}#{namespace}')
#app.task
def add(x, y):
return x + y
I'm trying to implement a live search through the jquery plugin Select2 in my Django 1.11.4 project. Running Python 3.6. When I type in the textbox, the server doesn't seem to be able to handle the number of requests and it closes, followed by these series of errors.
I've spent a couple hours following a couple threads on SO SO(more) , Google, etc but none have a working solution. I thought it was a python version issue, but I've upgraded from 2.7 to 3.6 and still have it. Any help would be great thanks!
This the view that's being called by the ajax call:
def directory_search(request):
# Query text from search bar
query = request.GET.get('q', None)
if query:
# Searches the DB for matching value
customers = Customer.objects.filter(
Q(name__icontains= query)|
Q(contract_account__icontains= query)|
Q(address__icontains= query)|
Q(address__icontains= query)|
Q(email__icontains= query)
).distinct()
# Turns queryset into dict
customers = customers.values("contract_account","name")
# Turns dict into list
customers_list = list(customers)
return JsonResponse(customers_list, safe=False)
else:
return JsonResponse(data={'success': False,'errors': 'No mathing items found'})
This is the js/ajax call for the Select2 plugin:
$(".customer-search-bar").select2({
ajax:{
dataType: 'json',
type: 'GET',
url:"{% url 'portal:directory_search' %}",
data: function (params) {
var queryParameters = {
q: params.term
}
return queryParameters;
},
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.name,
id: item.contract_account
}
})
};
}
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateResult: formatRepo,
templateSelection: formatRepoSelection,
language: { errorLoading:function(){ return "Searching..." }}
});
Errors: (I just broke them apart to make it more legible, but they occurred in the presented order)
1.
Traceback (most recent call last):
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
2.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\leep\PythonStuff\virtual_environments\rpp_3.6\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
super(ServerHandler, self).handle_error()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
3.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Users\leep\PythonStuff\virtual_environments\rpp_3.6\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
handler.run(self.server.get_app())
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Users\leep\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
It appears that its a python 2.7 known bug, maybe it remains on python 3.6:
https://bugs.python.org/issue14574
I'm having a similar issue in django, also running python 3.6
TypeError: 'NoneType' object is not subscriptable followed by AttributeError: 'NoneType' object has no attribute 'split'
Edit
It seems to be a error on chrome. It didn't come to me, 'cause I was using Opera, but opera uses chromium as well. In internet explorer the error didn't show.
https://code.djangoproject.com/ticket/21227#no1
This is the bug tracker
I am trying to use gevent based server with remote datastore api and, i occasionally get
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 884, in handle_one_response
self.run_application()
File "/home/abhinavabcd_gmail_com/samosa-scripts/samosa_messaging_framework/geventwebsocket/handler.py", line 76, in run_ap
plication
self.run_websocket()
File "/home/abhinavabcd_gmail_com/samosa-scripts/samosa_messaging_framework/geventwebsocket/handler.py", line 52, in run_we
bsocket
self.application(self.environ, lambda s, h, e=None: [])
File "server.py", line 478, in __call__
current_app.handle()
File "/home/abhinavabcd_gmail_com/samosa-scripts/samosa_messaging_framework/geventwebsocket/resource.py", line 23, in handl
e
self.protocol.on_close()
File "/home/abhinavabcd_gmail_com/samosa-scripts/samosa_messaging_framework/geventwebsocket/protocols/base.py", line 14, in
on_close
self.app.on_close(reason)
File "server.py", line 520, in on_close
current_node.destroy_connection(self.ws)
File "server.py", line 428, in destroy_connection
db.remove_connection(conn.connection_id)
File "/home/abhinavabcd_gmail_com/samosa-scripts/samosa_messaging_framework/database_ndb.py", line 141, in remove_connectio
n
key.delete()
File "/home/abhinavabcd_gmail_com/google_appengine/google/appengine/ext/ndb/model.py", line 3451, in _put
return self._put_async(**ctx_options).get_result()
File "/home/abhinavabcd_gmail_com/google_appengine/google/appengine/ext/ndb/tasklets.py", line 383, in get_result
self.check_success()
File "/home/abhinavabcd_gmail_com/google_appengine/google/appengine/ext/ndb/tasklets.py", line 378, in check_success
self.wait()
File "/home/abhinavabcd_gmail_com/google_appengine/google/appengine/ext/ndb/tasklets.py", line 362, in wait
if not ev.run1():
File "/home/abhinavabcd_gmail_com/google_appengine/google/appengine/ext/ndb/eventloop.py", line 253, in run1
delay = self.run0()
File "/home/abhinavabcd_gmail_com/google_appengine/google/appengine/ext/ndb/eventloop.py", line 238, in run0
(rpc, self.rpcs))
RuntimeError: rpc <google.appengine.api.apiproxy_stub_map.UserRPC object at 0x7fb46e754a90> was not given to wait_any as a ch
oice {<google.appengine.api.apiproxy_stub_map.UserRPC object at 0x7fb46e779f90>: (<bound method Future._on_rpc_completion of
<Future 7fb46e756f10 created by run_queue(context.py:185) for tasklet _memcache_set_tasklet(context.py:1111); pending>>, (<go
ogle.appengine.api.apiproxy_stub_map.UserRPC object at 0x7fb46e779f90>, '', <google.appengine.datastore.datastore_rpc.Connect
ion object at 0x7fb46e874250>, <generator object _memcache_set_tasklet at 0x7fb46e79b9b0>), {}), <google.appengine.api.apipro
xy_stub_map.UserRPC object at 0x7fb46e75c690>: (<bound method Future._on_rpc_completion of <Future 7fb46e7c8950 created by ru
n_queue(context.py:185) for tasklet _memcache_set_tasklet(context.py:1111); pending>>, (<google.appengine.api.apiproxy_stub_m
ap.UserRPC object at 0x7fb46e75c690>, '', <google.appengine.datastore.datastore_rpc.Connection object at 0x7fb46e7c8ad0>, <ge
nerator object _memcache_set_tasklet at 0x7fb46e6f3640>), {})}
# monkey patched already
try:
import dev_appserver
dev_appserver.fix_sys_path()
except ImportError:
print('Please make sure the App Engine SDK is in your PYTHONPATH.')
raise
email = '----SERVICE_ACCOUNT_EMAIL-------'
from google.appengine.ext.remote_api import remote_api_stub remote_api_stub.ConfigureRemoteApiForOAuth(
'{}.appspot.com'.format("XXXPROJECT_IDXXX"),
'/_ah/remote_api' ,
service_account=email,
key_file_path='KEY---1927925e9abc.p12')
import config
from google.appengine.ext import ndb
from lru_cache import LRUCache
It happens occasionally , with datastore write operations , put and delete.
Any pointers to understand/fix this appreciated.