rpc python

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

rpc python

johnd
I am trying to get the rpc python stuff running...

I have the  contrib  rpcpython code from trunk

I can import simplejson from a python shell

when I run it I get this:

>python ./start-server.py
Traceback (most recent call last):
  File "./start-server.py", line 38, in <module>
    import qxjsonrpc
  File "/home/john/qooxdoo-1.3-sdk/tmp/qooxdoo-contrib/RpcPython/trunk/services/qxjsonrpc/__init__.py",
line 52, in <module>
    from qxjsonrpc._request import *
  File "/home/john/qooxdoo-1.3-sdk/tmp/qooxdoo-contrib/RpcPython/trunk/services/qxjsonrpc/_request.py",
line 24, in <module>
    from qxjsonrpc.json import *
  File "/home/john/qooxdoo-1.3-sdk/tmp/qooxdoo-contrib/RpcPython/trunk/services/qxjsonrpc/json.py",
line 205, in <module>
    'No package found to encode python objects to JSON! Please install
a supported package. See INSTALL file for more information.'
AssertionError: No package found to encode python objects to JSON!
Please install a supported package. See INSTALL file for more
information.

i changed json.py to have this:
use_python_cjson=False


Anyone using this stuff?

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

Joachim Baran
Hi!

On 23 February 2011 17:40, John de la Garza <[hidden email]> wrote:
AssertionError: No package found to encode python objects to JSON!
Please install a supported package. See INSTALL file for more
information.

i changed json.py to have this:
use_python_cjson=False
  Would you not have to install the respective Python package for JSON support?

  I do not use Python, but instead I use Ruby which is very similar to Python. There I just invoke my script via Apache/lighttpd and use a CGI-object to fiddle out the JSON-string from the HTTP request. That JSON-string is then passed into a JSON-parser which returns me a Ruby representation of the JSON-object. The Ruby gems for that are 'cgi' and 'json'. You should be able to do something similar for Python.

  Hope that helps.

Joachim

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

Jeremiah Dodds
In reply to this post by johnd


On Wed, Feb 23, 2011 at 5:40 PM, John de la Garza <[hidden email]> wrote:
I
line 205, in <module>
   'No package found to encode python objects to JSON! Please install
a supported package. See INSTALL file for more information.'
AssertionError: No package found to encode python objects to JSON!
Please install a supported package. See INSTALL file for more
information.

i changed json.py to have this:
use_python_cjson=False


Anyone using this stuff?


What version of python are you using? Try "python -v" if it's <2.6 , you'll want to do something
like "sudo easy install simplejson". 2.5 doesn't have a built in json lib.
 
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

johnd
On Wed, Feb 23, 2011 at 4:55 PM, Jeremiah Dodds
<[hidden email]> wrote:
>

> What version of python are you using? Try "python -v" if it's <2.6 , you'll
> want to do something
> like "sudo easy install simplejson". 2.5 doesn't have a built in json lib.
>
>>

I am using 2.6, I now have cjson installed and also simplejson is
already installed, too.

That was going to be my next question.  I mean if 2.6 was OK.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

Jeremiah Dodds


On Wed, Feb 23, 2011 at 8:06 PM, John de la Garza <[hidden email]> wrote:
On Wed, Feb 23, 2011 at 4:55 PM, Jeremiah Dodds
<[hidden email]> wrote:


I am using 2.6, I now have cjson installed and also simplejson is
already installed, too.

That was going to be my next question.  I mean if 2.6 was OK.


My only guess is that the import is failing. I can't check it on my machine right now, but check  RpcPython/trunk/services/qxjsonrpc/json.py , lines 112 and 149. Try removing that try/except/else or taking a look at the errors, "python -m pdb ./start-server.py" could provide some insight as well.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

johnd
On Wed, Feb 23, 2011 at 5:22 PM, Jeremiah Dodds
<[hidden email]> wrote:
>

>
> My only guess is that the import is failing. I can't check it on my machine
> right now, but check  RpcPython/trunk/services/qxjsonrpc/json.py , lines 112
> and 149. Try removing that try/except/else or taking a look at the errors,
> "python -m pdb ./start-server.py" could provide some insight as well.


I don't understand ho it can work with the imports removed.  it uses
those imports

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

Jeremiah Dodds


On Thu, Feb 24, 2011 at 12:23 PM, John de la Garza <[hidden email]> wrote:
On Wed, Feb 23, 2011 at 5:22 PM, Jeremiah Dodds
<[hidden email]> wrote:
>

>
> My only guess is that the import is failing. I can't check it on my machine
> right now, but check  RpcPython/trunk/services/qxjsonrpc/json.py , lines 112
> and 149. Try removing that try/except/else or taking a look at the errors,
> "python -m pdb ./start-server.py" could provide some insight as well.


I don't understand ho it can work with the imports removed.  it uses
those imports


It can't, looking at the code, it looks like the import of simplejson must be failing in that file. The block of code trys to import simplejson (or cjson), catches an exception if the import fails, and creates things otherwise. I didn't mean to remove the entire block of code, just the exception handling -- right now when the import of simplejson fails, assuming that's what happens, you don't  know anything about it because it just "pass"es. Running through python -m pdb will let you step up from the faliure, which could illuminate some things, or commenting out just the try, except, and else lines would skip the whole "just pass if the import fails" thing. You could also just change "pass" to "raise", I think.

Another possible reason for failure would be if there's a simplejson in your working directory that is overshadowing the system's one...

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

johnd
On Thu, Feb 24, 2011 at 10:32 AM, Jeremiah Dodds
<[hidden email]> wrote:

>
>
> On Thu, Feb 24, 2011 at 12:23 PM, John de la Garza <[hidden email]> wrote:
>>
>> On Wed, Feb 23, 2011 at 5:22 PM, Jeremiah Dodds
>> <[hidden email]> wrote:
>
> Another possible reason for failure would be if there's a simplejson in your
> working directory that is overshadowing the system's one...
> ------------------------------------------------------------------------------
>

I just built cjson 1.3 and it works.  but now I am having trouble
doing a simple rpc call.

I posted message the describes my new problem.  Thanks for the help in
resolving this issue.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: rpc python

Jeremiah Dodds


On Thu, Feb 24, 2011 at 1:58 PM, John de la Garza <[hidden email]> wrote:

I just built cjson 1.3 and it works.  but now I am having trouble
doing a simple rpc call.

I posted message the describes my new problem.  Thanks for the help in
resolving this issue.


Glad to help. FWIW, you might want to consider sending a message to the 
maintainer of the contribution, or opening a bug report -- the contrib hasn't 
been updated in 14 months, and there have apparently been api changes in
it's dependencies that break functionality. 

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel