Bug 738514 - zanata push fails with JSON error
Summary: zanata push fails with JSON error
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-PythonClient
Version: 1.3
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Runa Bhattacharjee
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-15 03:51 UTC by Joshua Wulf
Modified: 2014-10-19 22:59 UTC (History)
5 users (show)

Fixed In Version: 1.3.0-23-gab314ce
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-10-28 07:25:24 UTC
Embargoed:


Attachments (Terms of Use)

Description Joshua Wulf 2011-09-15 03:51:42 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1

zanata 1.3.1 on F15.

Reproducible: Always

Steps to Reproduce:
1.Run zanata publican push
2.
3.
Actual Results:  
[jwulf@gaura Zanata_Translator_Quickstart]$ zanata push --project-type=publican
Loading zanata project config from: /home/jwulf/Work/Zanata/Zanata_Translator_Quickstart/zanata.xml
Loading zanata user config from: /home/jwulf/.config/zanata.ini
zanata server: 
http://zanata-endeavour.lab.eng.bne.redhat.com:8080/

Traceback (most recent call last):
  File "/usr/bin/zanata", line 25, in <module>
    zanata.run()
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 1223, in run
    program_name=os.path.split(sys.argv[0])[1],
  File "/usr/lib/python2.7/site-packages/zanataclient/command.py", line 325, in handle_program
    command(command_options, args)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 1018, in push
    get_version(url)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 371, in get_version
    content = version.get_server_version()
  File "/usr/lib/python2.7/site-packages/zanataclient/zanatalib/versionservice.py", line 45, in get_server_version
    version = json.loads(content)
  File "/usr/lib64/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 360, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 378, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


Expected Results:  
Zanata should push project to the server.

When the username / apikey pair is incorrect, the following occurs:


[jwulf@gaura Zanata_Translator_Quickstart]$ zanata publican push
Loading zanata project config from: /home/jwulf/Work/Zanata/Zanata_Translator_Quickstart/zanata.xml
Loading zanata user config from: /home/jwulf/.config/zanata.ini
zanata server: 
http://zanata-endeavour.lab.eng.bne.redhat.com:8080

zanata python client version: 1.3.0, zanata server API version: 1.4-SNAPSHOT
error: Please specify username and apikey in zanata.ini or with '--username' and '--apikey' options


Note that the server version is correctly reported here. The error message produced when the apikey / username pair is correct suggests that retrieving the server version is the cause of the error.

Comment 1 Joshua Wulf 2011-09-15 04:11:25 UTC
Also zanata-python-client-1.3.0-1.fc15.noarch on F15

Comment 2 James Ni 2011-09-29 07:54:30 UTC
This bug is due to the '\n' or white space in URL, i have modify the source on upstream to trim the URL. Also, it is better to check the <url> tag in zanata.xml and make sure that URL doesn't include new line.

Comment 3 Ding-Yi Chen 2011-10-04 01:01:03 UTC
James,

It looks like the data is invalid, did you change your source code to handle this by display error messages or try to remove the white space?

If not, please close it as NOTABUG instead.

Comment 4 James Ni 2011-10-10 04:31:29 UTC
Hi Ding

Yes, I have modified the source code to handle this by removing the white space or '\n', also giving a warning messages if URL contains white space or '\n'

Comment 5 Ding-Yi Chen 2011-10-12 00:49:19 UTC
VERIFIED with commit ab314cee446132875151823aaf9807c18c564ac2


Note You need to log in before you can comment on or make changes to this bug.