hitrust / google-wave-resources

Automatically exported from code.google.com/p/google-wave-resources
1 stars 0 forks source link

Bug: Python API Callstack #669

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When trying a simple sample Python robot using the v2 robots api, I get 
the following exception in my appengine log:

'unicode' object has no attribute 'get'

It appears to be failing before it even gets to my event handler.

Here's the full trace:

Traceback (most recent call last):
  File 
"/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", 
line 509, in __call__
    handler.post(*groups)
  File "/base/data/home/apps/chrismdp-
pushy/1.340253635551602547/waveapi/appengine_robot_runner.py", 
line 82, in post
    json_response = self._robot.process_events(json_body)
  File "/base/data/home/apps/chrismdp-
pushy/1.340253635551602547/waveapi/robot.py", line 356, in 
process_events
    event_wavelet = self._wavelet_from_json(parsed, pending_ops)
  File "/base/data/home/apps/chrismdp-
pushy/1.340253635551602547/waveapi/robot.py", line 332, in 
_wavelet_from_json
    blips[blip_id] = blip.Blip(raw_blip_data, blips, pending_ops)
  File "/base/data/home/apps/chrismdp-
pushy/1.340253635551602547/waveapi/blip.py", line 579, in __init__
    self._blip_id = json.get('blipId')
AttributeError: 'unicode' object has no attribute 'get'

Here's the code I'm using. I'm using the waveapi from wave-robot-api-v2-
03022010.zip.

def Main():
    logging.getLogger().setLevel(logging.DEBUG)
    myRobot = robot.Robot('Pushy', 
        image_url='http://chrismdp-
pushy.appspot.com/assets/icon.png',
        profile_url='http://chrismdp-pushy.appspot.com/')
    myRobot.register_handler(events.WaveletSelfAdded, OnRobotAdded)
    appengine_robot_runner.run(myRobot)

def OnRobotAdded(event, wavelet):
    """Invoked when the robot has been added."""
    logging.debug("Called OnRobotAdded event handler. Wavelet: 
"+wavelet)
    # post welcome message
    wavelet.reply("Hello!")

Original issue reported on code.google.com by Chris...@gmail.com on 2 Mar 2010 at 3:34

GoogleCodeExporter commented 9 years ago
Is this using a robot on an old application identifier? The robot should 
refresh to use 
the new API after the first operation with a v2 capabilities.xml, but if it 
doesn't, 
then that is a bug on our end.

Can you try it with a new App ID and see what happens?

Original comment by pamela.fox on 2 Mar 2010 at 3:36

GoogleCodeExporter commented 9 years ago
Yes, after fixing another (unrelated) bug, it works fine using chrismdp-
test@appspot.com.

Original comment by Chris...@gmail.com on 2 Mar 2010 at 3:45

GoogleCodeExporter commented 9 years ago
I confirm the same situation. Same traceback when pushing to an appengine 
domain which 
used to have a version 1 robot. And works correctly after creating new 
appengine 
domain. 
I used the code from the python tutorial.

Original comment by duncan.hawthorne on 2 Mar 2010 at 9:46

GoogleCodeExporter commented 9 years ago
For ease of debugging, can you join this forum thread?
https://wave.google.com/wave/#restored:search:with%253Apublic+with%253Aforumbott
y+tag%
253Awave-api,restored:wave:googlewave.com!w%252B9EgFHaidD

It will be easier to work through it there.

My current explorations have not found a bug on our part yet. 

Original comment by pamela.fox on 2 Mar 2010 at 11:54

GoogleCodeExporter commented 9 years ago
Ran into the same problem. After starting a new wave with the robot (to get 
/_wave/capabilities.xml reloaded) the error disappeared.

Original comment by martin.b...@gmail.com on 12 Jun 2010 at 4:11

GoogleCodeExporter commented 9 years ago
But problem remains for existing waves with the robot. Removing the robot and 
adding it again to the wave has no effect.

Original comment by martin.b...@gmail.com on 12 Jun 2010 at 4:46

GoogleCodeExporter commented 9 years ago
Found a tip by Duncan on the debugging wave:

as a workaround I removed character-entity@appspot.com from my waves and added 
character-entity+1@appspot.com, which if your robot isnt handling proxy 
requests means the same code is run 

This sounds like a nice option since it doesn't require setting up a new 
appengine ID, and it continues to access the existing data stored for the 
application.

Original comment by Klaus.We...@gmail.com on 25 Jun 2010 at 12:54

GoogleCodeExporter commented 9 years ago
FYI, the "name+1" trick didn't work when I tried it today, but adding the 
version ("name#VERSION@appspot.com") did the trick. Unfortunately there's no 
easy way to communicate that to users in whose waves the robot isn't working.

Original comment by Klaus.We...@gmail.com on 30 Jun 2010 at 3:15