OCA / connector-woocommerce

GNU Affero General Public License v3.0
53 stars 106 forks source link

JsonDecode Error right after installation of module. #22

Open voragantivenugopal opened 8 years ago

voragantivenugopal commented 8 years ago

I'm Getting JSONDecodeError: Expecting value: line 1 column 1 (char 0) when I click on 'Check Connection' button on the Backend menu.

ghost commented 8 years ago

@voragantivenugopal Do you have solve this issue?

Regards

d1ch0t0my commented 8 years ago

Same issue:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/openerp/http.py", line 539, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/site-packages/openerp/http.py", line 576, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/site-packages/openerp/http.py", line 312, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openerp/http.py", line 309, in checked_call
    return self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/site-packages/openerp/http.py", line 805, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/site-packages/openerp/http.py", line 405, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/site-packages/openerp/addons/web/controllers/main.py", line 948, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python2.7/site-packages/openerp/addons/web/controllers/main.py", line 936, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openerp/api.py", line 399, in old_api
    result = method(recs, *args, **kwargs)
  File "/var/lib/odoo/addons/8.0/connector_woocommerce/model/backend.py", line 105, in test_connection
    val = r.json()
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 802, in json
    return json.loads(self.text, **kwargs)
  File "/usr/lib64/python2.7/site-packages/simplejson/__init__.py", line 488, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib64/python2.7/site-packages/simplejson/decoder.py", line 389, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Ignoring it and activating the cron jobs shows the error differently in the Odoo log as:

Traceback (most recent call last):
  File "/var/lib/odoo/addons/8.0/connector/queue/worker.py", line 124, in run_job
    job.perform(session)
  File "/var/lib/odoo/addons/8.0/connector/queue/job.py", line 512, in perform
    self.result = self.func(session, *self.args, **self.kwargs)
  File "/var/lib/odoo/addons/8.0/connector_woocommerce/model/product.py", line 330, in product_import_batch
    importer.run(filters=filters)
  File "/var/lib/odoo/addons/8.0/connector_woocommerce/model/product.py", line 144, in run
    to_date=to_date,
  File "/var/lib/odoo/addons/8.0/connector_woocommerce/model/product.py", line 112, in search
    [filters] if filters else [{}])
  File "/var/lib/odoo/addons/8.0/connector_woocommerce/model/product.py", line 84, in _call
    return super(ProductProductAdapter, self)._call(method, arguments)
  File "/var/lib/odoo/addons/8.0/connector_woocommerce/unit/backend_adapter.py", line 152, in _call
    result = safe_eval(result)
  File "/usr/lib/python2.7/site-packages/openerp/tools/safe_eval.py", line 312, in safe_eval
    c = test_expr(expr, _SAFE_OPCODES, mode=mode)
  File "/usr/lib/python2.7/site-packages/openerp/tools/safe_eval.py", line 167, in test_expr
    code_obj = compile(expr, "", mode)
  File "<string>", line 1
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax
d1ch0t0my commented 8 years ago

Solved it. WP/Woocommerce must have permalinks set to Sample Post:

http://woothemes.github.io/woocommerce-rest-api-docs/#schema

This isn't mentioned anywhere that I've seen in the video that accompanies this or the docs so may be worth adding that in any future ReadMe. Now that I've set this the JSON calls are correctly being allocated. Hope this helps someone.

vvipi91 commented 8 years ago

Hi, i also face the same issue. set the permalinks to sample post. but still it shows the error. Any additional settings needed in the wordpress side.

rubencabrera commented 8 years ago

Thanks, @d1ch0t0my ! It worked for me to check connections, BUT still getting errors on jobs.