jianlinwei / pygooglevoice

Automatically exported from code.google.com/p/pygooglevoice
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Sending SMS raises: ValueError("No JSON object could be decoded") #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Running the "Send SMS Example"  
http://sphinxdoc.github.com/pygooglevoice/examples.html#send-sms-messages
2. Logged in
3. Sent a message to another gvoice number:

Number to send message to: 8472824467
Message text: test json message

What is the expected output? What do you see instead?
Expected to get a success confirmation

Instead, I get: 
Traceback (most recent call last):
  File "send_smss.py", line 10, in <module>
    voice.send_sms(phoneNumber, text)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/googlevoice/voice.py", line 140, in send_sms
    self.__validate_special_page('sms', {'phoneNumber': phoneNumber, 'text': text})
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/googlevoice/voice.py", line 210, in __validate_special_page
    load_and_validate(self.__do_special_page(page, data))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/googlevoice/util.py", line 65, in load_and_validate
    validate_response(loads(response.read()))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 319, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 338, in raw_decode
    raise ValueError("No JSON object could be decoded")

What version of the product are you using? On what operating system?
pygooglevoice-0.5, python 2.6 via macports

Please provide any additional information below.

Original issue reported on code.google.com by jfeldst...@gmail.com on 27 Jan 2011 at 4:32

Attachments:

GoogleCodeExporter commented 9 years ago
I have this problem too.

pygooglevoice-0.5
simplejson 2.1.3
python 2.4.3 via source code
CentOS 5.3

Original comment by hookd...@gmail.com on 1 Feb 2011 at 9:36

GoogleCodeExporter commented 9 years ago
It appears to be a problem that comes form login issues...
See Issue 58 and 60

This solution from Issue 60 by misterich fixed my problem:
http://code.google.com/p/pygooglevoice/issues/detail?id=60#c10

For the lazy:
Edit the settings.py > LOGIN to point to a new URL 
[path-on-your-machine]/googlevoice/settings.py
Change the login as follows:
# (old) LOGIN = 
'https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral'
LOGIN   = 
"https://accounts.google.com/ServiceLogin?service=grandcentral&passive=1209600&c
ontinue=https://www.google.com/voice&followup=https://www.google.com/voice<mpl=o
pen"

Original comment by aboz...@gmail.com on 6 Oct 2011 at 4:52