Discussion:
JSONRPCError when django appliccation deployed on apache server.
rohit jaiswal
2018-06-20 09:56:03 UTC
Permalink
Hi ,


I have a very weird error like this


{"error_structure": null, "version": "1.1", "id": "25", "error": {"message": "AttributeError:
'int' object has no attribute 'encode'", "code": 100, "name": "JSONRPCError"
}}


Same code runs perfectly fine locally but when deployed on apache
httpd-2.4.29-1.x86_64 it throws above error(and not every time, same code
sometime works and sometimes not).


The rpc method connects to db fetch data based on arguments passed and
return the data. Explicitly wrapping up the integer argument with str()
works fine on server.


I have a belief that there is something missing with apache/mod_wsgi
configuration. I am using Djangorestframework 2.2.4.


Does anyone has idea or clue about this behavior ?
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jason
2018-06-21 10:35:25 UTC
Permalink
DRF 2.2.4 is *way* out of date. Current version is 3.8, so I don't know if
you'll get any relevant help for such an out of date version..

At the least, I'd suggest updating to the latest compatible version and
trying again.
Post by rohit jaiswal
Hi ,
I have a very weird error like this
{"error_structure": null, "version": "1.1", "id": "25", "error": {
"message": "AttributeError: 'int' object has no attribute 'encode'",
"code": 100, "name": "JSONRPCError"}}
Same code runs perfectly fine locally but when deployed on apache
httpd-2.4.29-1.x86_64 it throws above error(and not every time, same code
sometime works and sometimes not).
The rpc method connects to db fetch data based on arguments passed and
return the data. Explicitly wrapping up the integer argument with str()
works fine on server.
I have a belief that there is something missing with apache/mod_wsgi
configuration. I am using Djangorestframework 2.2.4.
Does anyone has idea or clue about this behavior ?
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jason
2018-06-21 10:37:50 UTC
Permalink
Wow, according to the release
https://github.com/encode/django-rest-framework/releases/tag/2.2.4 info,
that version was released March of 2013, over five years ago.
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jani Tiainen
2018-06-21 20:53:45 UTC
Permalink
Hi,

It's weird error and I suspect that it has nothing to do with DRF which is
REST API tool and doesn't have anything related to JSONRPC.

Without code and full traceback it's virtually impossible to say what's
wrong with your code.
Post by rohit jaiswal
Hi ,
I have a very weird error like this
{"error_structure": null, "version": "1.1", "id": "25", "error": {
"message": "AttributeError: 'int' object has no attribute 'encode'",
"code": 100, "name": "JSONRPCError"}}
Same code runs perfectly fine locally but when deployed on apache
httpd-2.4.29-1.x86_64 it throws above error(and not every time, same code
sometime works and sometimes not).
The rpc method connects to db fetch data based on arguments passed and
return the data. Explicitly wrapping up the integer argument with str()
works fine on server.
I have a belief that there is something missing with apache/mod_wsgi
configuration. I am using Djangorestframework 2.2.4.
Does anyone has idea or clue about this behavior ?
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
rohit jaiswal
2018-06-22 09:25:51 UTC
Permalink
Hi ,

I guess Jani Tiainen is right it has nothing to do with the DRF. I am
using Sql alchemy ORM to fetch the data from DB. I just type caste the
int(rpc argument that is used to fetch data from DB) to str and it works
smoothly str(int). But I was curious to know why previously, some time it
worked and sometime it did not. Locally I am not able to reproduce it. I
will debug and post it here if I found anything.

Thanks,
Rohit Jaiswal
Post by Jani Tiainen
Hi,
It's weird error and I suspect that it has nothing to do with DRF which is
REST API tool and doesn't have anything related to JSONRPC.
Without code and full traceback it's virtually impossible to say what's
wrong with your code.
Post by rohit jaiswal
Hi ,
I have a very weird error like this
{"error_structure": null, "version": "1.1", "id": "25", "error": {
"message": "AttributeError: 'int' object has no attribute 'encode'",
"code": 100, "name": "JSONRPCError"}}
Same code runs perfectly fine locally but when deployed on apache
httpd-2.4.29-1.x86_64 it throws above error(and not every time, same code
sometime works and sometimes not).
The rpc method connects to db fetch data based on arguments passed and
return the data. Explicitly wrapping up the integer argument with str()
works fine on server.
I have a belief that there is something missing with apache/mod_wsgi
configuration. I am using Djangorestframework 2.2.4.
Does anyone has idea or clue about this behavior ?
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...