tinyerp / erppeek

A versatile tool for Odoo / OpenERP. *** Forked as Odooly ⟶
https://github.com/tinyerp/odooly
Other
171 stars 99 forks source link

Initializing Client with wrong server hangs process #69

Closed PCatinean closed 9 years ago

PCatinean commented 9 years ago

try: erppeek.Client('dsadas') except IOError: print "This is a error!"

Proccess hangs after this and you cannot escape it

matrixise commented 9 years ago

Please, could you show the traceback ? without the except IOError

Thank you

PCatinean commented 9 years ago

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/erppeek.py", line 1555, in runcode _exec(code, global_vars) File "/usr/local/lib/python2.7/dist-packages/erppeek.py", line 1520, in _exec exec('exec code in g') File "", line 1, in File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/erppeek.py", line 421, in init self.server_version = ver = get_proxy('db').server_version() File "/usr/local/lib/python2.7/dist-packages/erppeek.py", line 420, in get_proxy return Service(server, name, methods, verbose=verbose) File "/usr/local/lib/python2.7/dist-packages/erppeek.py", line 336, in init proxy = ServerProxy(rpcpath + endpoint, allow_none=True) File "/usr/lib/python2.7/xmlrpclib.py", line 1549, in init raise IOError, "unsupported XML-RPC protocol" IOError: unsupported XML-RPC protocol () >>>

matrixise commented 9 years ago

Your hostname is wrong.

If you read the code of xmlrpclib.py in the init method, you can read that

        import urllib
        type, uri = urllib.splittype(uri)
        if type not in ("http", "https"):
            raise IOError, "unsupported XML-RPC protocol"

The signature of the function is

erppeek.Client('SCHEME://HOSTNAME:PORT', DATABASE, USERNAME, PASSWORD)

or

erppeek.Client('http://localhost:8069', 'odoo', 'admin', 'admin')

Read the code and the examples or this tutorial http://wirtel.be/posts/en/2014/06/13/using_erppeek_to_discuss_with_openerp/

Thank you

PCatinean commented 9 years ago

Thank you for the reply matrixise, I know it is wrong I was just curious why the error thrown cannot be bypassed and it hangs the process

florentx commented 9 years ago

I confirm there's a bug due to a recursion in the __del__ method when the wrong parameter is passed to the constructor. Thank you @PCatinean

florentx commented 9 years ago

The fix will be in 1.6.2