GAE xmpp app shows invalid JID error - python

Currently I'm testing appengine-crowdguru-python this app by sending xmpp messages from http://localhost:8000/xmpp which has a form to post data .. I have filled from, to, chat (message) fields.
From : avinash#app-live.appspotchat.com
To : ajin#app-live.appspotchat.com
Chat: /tellme Who is Clinton?
where app-live app-id is currently on live. I also changed from and to fields to the ids like avi#xmpp.jp where this account is created through https://www.xmpp.jp/signup but it still shows invalid JID..
ERROR 2016-06-06 08:45:32,157 wsgi.py:280]
Traceback (most recent call last):
File "/home/gemini/softwares/google_appengine/google/appengine/runtime/wsgi.py", line 268, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/home/gemini/softwares/google_appengine/google/appengine/ext/webapp/xmpp_handlers.py", line 63, in handle_exception
super(BaseHandler, self).handle_exception(exception, debug_mode)
File "/home/gemini/softwares/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/home/gemini/PycharmProjects/appengine-crowdguru-python/guru.py", line 222, in post
super(XmppHandler, self).post()
File "/home/gemini/softwares/google_appengine/google/appengine/ext/webapp/xmpp_handlers.py", line 73, in post
self.message_received(self.xmpp_message)
File "/home/gemini/softwares/google_appengine/google/appengine/ext/webapp/xmpp_handlers.py", line 118, in message_received
handler(message)
File "/home/gemini/PycharmProjects/appengine-crowdguru-python/guru.py", line 302, in tellme_command
message.reply(WAIT_MSG)
File "/home/gemini/softwares/google_appengine/google/appengine/api/xmpp/__init__.py", line 515, in reply
message_type=message_type, raw_xml=raw_xml)
File "/home/gemini/softwares/google_appengine/google/appengine/api/xmpp/__init__.py", line 346, in send_message
raise InvalidJidError()
InvalidJidError

A common behaviour of "get Jid" it's error if Resource (in login phase) it's not definied due to the Jid composition ( user # server /resource). A "full jid" it's complete of Resource, so if it's null you can have a null pointer and so an error.
How to handle:
SOLUTION 1: retrive just "bare Jid"
SOLUTION 2: define a resource (it's a custom name that represent your client).
Hope that's help.

Related

ValueError: RSA key format is not supported

trying to use big query on google app engine python. I am trying to achieve this using a this client library . I have imported every necessary library and somehow running the snippet below
from bigquery import get_client
# BigQuery project id as listed in the Google Developers Console.
project_id = 'project_id'
# Service account email address as listed in the Google Developers Console.
service_account = 'my_id_123#developer.gserviceaccount.com'
# PKCS12 or PEM key provided by Google.
key = 'key.pem'
client = get_client(project_id, service_account=service_account,
private_key_file=key, readonly=True)
and still get the error:
2015-10-26 19:08:37 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=19090', '--admin_port=9010', 'C:\\Users\\CrowdStar\\workspace\\AppEngineThinkStudio\\TrafficTestCase']"
INFO 2015-10-26 19:08:39,540 devappserver2.py:726] Skipping SDK update check.
INFO 2015-10-26 19:08:39,634 api_server.py:172] Starting API server at: http://localhost:61626
INFO 2015-10-26 19:08:39,634 dispatcher.py:186] Starting module "default" running at: http://localhost:19090
INFO 2015-10-26 19:08:39,651 admin_server.py:118] Starting admin server at: http://localhost:9010
INFO 2015-10-26 18:08:44,361 discovery.py:240] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest?userIp=%3A%3A1
INFO 2015-10-26 18:08:44,361 client.py:563] Attempting refresh to obtain initial access_token
ERROR 2015-10-26 18:08:44,365 webapp2.py:1528] RSA key format is not supported
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\main.py", line 72, in get
private_key_file=key, readonly=True)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 83, in get_client
readonly=readonly)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 101, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\util.py", line 142, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 196, in build
cache)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 242, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 565, in new_request
self._refresh(request_orig)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 835, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 862, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1541, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1670, in _generate_assertion
private_key, self.private_key_password), payload)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\_pycrypto_crypt.py", line 121, in from_string
pkey = RSA.importKey(parsed_pem_key)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 665, in importKey
return self._importKeyDER(der)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 588, in _importKeyDER
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
ERROR 2015-10-26 18:08:44,372 wsgi.py:279]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\main.py", line 72, in get
private_key_file=key, readonly=True)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 83, in get_client
readonly=readonly)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 101, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\util.py", line 142, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 196, in build
cache)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 242, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 565, in new_request
self._refresh(request_orig)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 835, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 862, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1541, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1670, in _generate_assertion
private_key, self.private_key_password), payload)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\_pycrypto_crypt.py", line 121, in from_string
pkey = RSA.importKey(parsed_pem_key)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 665, in importKey
return self._importKeyDER(der)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 588, in _importKeyDER
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
INFO 2015-10-26 19:08:44,404 module.py:737] default: "GET / HTTP/1.1" 500 -

CryptoUnavailableError: No crypto library available

I'm trying to run an application for AppEngine with python where I'm import the example module to get data from Google Analytics https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-py but when I run the server with dev_appserver.py and go to localhost:8080/ I recive an 505 error with his error in the console:
Traceback (most recent call last):
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/var/www/repositorios/PYTHON/dashboard/app.py", line 248, in get
print analyticsH.main()
File "/var/www/repositorios/PYTHON/dashboard/analyticsH.py", line 111, in main
service_account_email)
File "/var/www/repositorios/PYTHON/dashboard/analyticsH.py", line 35, in get_service
scope=scope)
File "/var/www/repositorios/PYTHON/dashboard/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/var/www/repositorios/PYTHON/dashboard/oauth2client/client.py", line 1503, in __init__ _RequireCryptoOrDie()
File "/var/www/repositorios/PYTHON/dashboard/oauth2client/client.py", line 1457, in _RequireCryptoOrDie
raise CryptoUnavailableError('No crypto library available')
CryptoUnavailableError: No crypto library available
I've searched and all that I've found is install openssl or install python-crypto or update python-dev, I doing everything but not works.
Thank you.

unable to configure apprtc.appspot with own url

This is the error I get when I try to configure apprtc with my own url. I tried to set up my own Turn Server and also tried to give a client url but it still did not work .
<HttpError 404 when requesting https://www.googleapis.com/bigquery/v2/projects/esuioswebrtc/datasets/prod/tables/analytics/insertAll?alt=json returned "Not Found: Table esuioswebrtc:prod.analytics">
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~esuioswebrtc/2.382445032671238924/apprtc.py", line 503, in post
result = add_client_to_room(self.request, room_id, client_id, is_loopback)
File "/base/data/home/apps/s~esuioswebrtc/2.382445032671238924/apprtc.py", line 373, in add_client_to_room
host=request.host)
File "/base/data/home/apps/s~esuioswebrtc/2.382445032671238924/analytics.py", line 114, in report_event
analytics.report_event(*args, **kwargs)
File "/base/data/home/apps/s~esuioswebrtc/2.382445032671238924/analytics.py", line 94, in report_event
body=obj).execute()
File "/base/data/home/apps/s~esuioswebrtc/2.382445032671238924/third_party/oauth2client/util.py", line 132, in positional_wrapper
return wrapped(*args, **kwargs)
File "/base/data/home/apps/s~esuioswebrtc/2.382445032671238924/third_party/apiclient/http.py", line 723, in execute
raise HttpError(resp, content, uri=self.uri)
HttpError: <HttpError 404 when requesting https://www.googleapis.com/bigquery/v2/projects/esuioswebrtc/datasets/prod/tables/analytics/insertAll?alt=json returned "Not Found: Table esuioswebrtc:prod.analytics">
In order to use insertAll to stream data into a table, you must first create the table and give it the schema you will use.
You should pre-create the table out of band from your streaming insert process, since the rate limits on these apis differ drastically. For scenarios where you stream data into daily tables, we recommend that you pre-create the next few days of tables on some sort of cron process so they are ready for data before you need to stream into them.

AppEngine MapReduce NDB, Repeated InternalError: internal error

We're trying to heavily use MapReduce in our project. Now we have this problem, there are a lot of 'InternalError: internal error.' errors in the log...
One example of it:
"POST /mapreduce/worker_callback HTTP/1.1" 500 0 "http://appname/mapreduce/worker_callback" "AppEngine-Google;
(+http://code.google.com/appengine)" "appname.appspot.com" ms=18856 cpu_ms=15980
queue_name=default task_name=appengine-mrshard-15828822618486744D69C-11-195
instance=00c61b117c47e0cba49bc5e5c7f9d328693e95ce
W 2012-10-24 06:51:27.140
suspended generator _put_tasklet(context.py:274) raised InternalError(internal error.)
W 2012-10-24 06:51:27.153
suspended generator put(context.py:703) raised InternalError(internal error.)
E 2012-10-24 06:51:27.207
internal error.
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~appname/1.362664407983567993/mapreduce/base_handler.py", line 65, in post
self.handle()
File "/base/data/home/apps/s~appname/1.362664407983567993/mapreduce/handlers.py", line 208, in handle
ctx.flush()
File "/base/data/home/apps/s~appname/1.362664407983567993/mapreduce/context.py", line 333, in flush
pool.flush()
File "/base/data/home/apps/s~appname/1.362664407983567993/mapreduce/context.py", line 221, in flush
self.__flush_ndb_puts()
File "/base/data/home/apps/s~appname/1.362664407983567993/mapreduce/context.py", line 239, in __flush_ndb_puts
ndb.put_multi(self.ndb_puts.items, config=self.__create_config())
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3650, in put_multi
for future in put_multi_async(entities, **ctx_options)]
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
self.check_success()
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
value = gen.throw(exc.__class__, exc, tb)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/context.py", line 703, in put
key = yield self._put_batcher.add(entity, options)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
value = gen.throw(exc.__class__, exc, tb)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/context.py", line 274, in _put_tasklet
keys = yield self._conn.async_put(options, datastore_entities)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 454, in _on_rpc_completion
result = rpc.get_result()
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 834, in get_result
result = rpc.get_result()
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1569, in __put_hook
self.check_rpc_success(rpc)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1224, in check_rpc_success
raise _ToDatastoreError(err)
InternalError: internal error.
queue.yaml:
queue:
- name: default
rate: 500/s
bucket_size: 100
max_concurrent_requests: 400
retry_parameters:
min_backoff_seconds: 5
max_backoff_seconds: 120
max_doublings: 2
MapReduce mapper params:
'shard_count': 16,
'processing_rate': 200,
'batch_size': 20
we would like to increase these numbers, since we need more speed in processing, but once we try to increase it increases error rate...
Blobstore Files Count: several ( some of them contain millions of lines )
Frontend Instance Class: F4
Processing flow:
We use only mapper for this particular processing.
We user BlobstoreLineInputReader (blob contains text file).
Each line represents new entry we need to create if it does not exist already(some of them we update).
My questions are:
How can we avoid these errors?
Are there any tips/hints on how we can choose/balance mapper params (shard_count, processing_rate, batch_size) ?
What happens with the job, does it get
retried (if so, how can we control it?) or not ?
BTW, we tried to play with some of the suggestions provided here (control batch_size) but we still see this.
This looks like a timeout error - check you logs to see how long that process is running before that happens.
If it is, you should try reducing the number of items that you're calling put_multi() on (ie reduce your batch size) and adding a timer check so that when your average time per put_multi() call gets close to the process time limit you quit and let another one start.

Urllib2 - Django - Broken Pipe

I am new to Django and I am experiencing some troubles posting data to a django webapp.
On the django side I have a form (backed by couchdb - couchdbkit django ext.).
On the client side I post data with urllib2, in bulk (going through a list of data to post one by one)
data = urllib.urlencode(param)
req = urllib2.Request(OBJECT_SERVICE_URL + '/objects/create/', data)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
res = urllib2.urlopen(req)
res.close()
After one record (one post passing), it get the message below, running again the next line passes and I have again this message :
res = urllib2.urlopen(req)
File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 435, in error
return self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR
The server says :
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 284, in run
self.finish_response()
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 324, in finish_response
self.write(data)
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 420, in write
self._write(data)
File "/usr/lib/python2.6/socket.py", line 318, in write
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59571)
self.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer
Traceback (most recent call last):
File "/usr/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
----------------------------------------
self.process_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 570, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
self.finish()
File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
self.wfile.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
I must state that I am working on the embedded django development web server...
And here is the output of the test :
======================================================================
ERROR: test_create_object (objects.tests.ObjectAppTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/patrick/workspace_py/objects/tests.py", line 21, in test_create_object
rs = c.post('/objects/create/', param)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 455, in post
response = super(Client, self).post(path, data=data, content_type=content_type, **extra)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 256, in post
return self.request(**r)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 387, in request
response = self.handler(environ)
File "/usr/local/lib/python2.6/dist-packages/django/test/client.py", line 84, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception
return callback(request, **param_dict)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/coffin/views/defaults.py", line 34, in server_error
content = render_to_string(template_name, Context({}))
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/coffin/template/loader.py", line 50, in render_to_string
template = get_template(template_name)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/coffin/template/loader.py", line 24, in get_template
return env.get_template(template_name)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/loaders.py", line 115, in load
source, filename, uptodate = self.get_source(environment, name)
File "/home/patrick/workspace_py/env/lib/python2.6/site-packages/jinja2/loaders.py", line 377, in get_source
raise TemplateNotFound(template)
TemplateNotFound: 500.html
----------------------------------------------------------------------
Does anyone know how to fix ?
Patrick
Some times I found weird errors and quick connection resets using development server (like in your log). If your application is about http, REST and webservices you should use Apache or Gunicorn so you feel a more realistic enviroment while developing.

Categories