Skip to content

ValueError: No JSON object could be decoded #25

Open
@oppianmatt

Description

@oppianmatt
Executing pull_translations on project pitchupcom
Pulling translations for "pitchupcom" project, in "en_GB" source language
Traceback (most recent call last):
  File "manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/app/pitchup/campsite/management/commands/tx.py", line 80, in handle
    command_func(*args[1:], **options)
  File "/app/pitchup/campsite/management/commands/tx.py", line 164, in transifex_pull_translations
    project_slug=self.project_slug, source_language=self.source_language
  File "/app/lib/djangotransifex/api.py", line 157, in pull_translations
    resources = self.list_resources(project_slug)
  File "/usr/local/lib/python2.7/site-packages/transifex/api.py", line 106, in list_resources
    return json.loads(response.content)
  File "/usr/local/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Using it in django-transifex but error is in here.

the response.content is no longer json encoded

image

according to the response headers it's python pickle format

image

My guess is that the request headers which by default set to accept / and a user agent of python-requests cause their api to issue a different format in response.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions