Python 3.4.1 and blitzdb issue

Juan Christian juan0christian at gmail.com
Wed Oct 22 18:38:12 CEST 2014


Oh yes, and here is what the call to the API returns:

{"adult":false,"also_known_as":["George Walton Lucas Jr.
"],"biography":"Arguably the most important film innovator in the history
of the medium, George Lucas continually \"pushed the envelope\" of
filmmaking technology since his early days as a student at U.S.C.
Considered a wunderkind by his contemporaries, he had a much harder time
communicating his vision to studio executives, whose meddling managed to
compromise each of his first three feature directing efforts in some way.
The monumental success of \"Star Wars\" (1977) ushered in the era of the
\"summer blockbuster,\" which, despite the later popularity of low budget
independent films, was still the prevailing mentality powering the
Hollywood engine.\n\nThough he set the tone and established the
expectations which influenced studios to devote the bulk of their resources
to films designed to blast off into hyperspace for spectacular profits, it
was doubtful that a film as revolutionary as \"Star Wars\" was in its day
could get made in the later blockbuster assembly line climate of the new
millennium.","birthday":"1944-05-14","deathday":"","homepage":"","id":1,"imdb_id":"nm0000184","name":"George
Lucas","place_of_birth":"Modesto - California -
USA","popularity":2.185575,"profile_path":"/rJ1zvSeZfge0mHtLnzJn4Mkw18S.jpg"}

On Wed, Oct 22, 2014 at 2:34 PM, Juan Christian <juan0christian at gmail.com>
wrote:

> Testing code:
>
> CODE ---------------------
>
> #!/usr/bin/env
>
> import requests
> from blitzdb import Document, FileBackend
>
>
> API_URL = 'http://api.themoviedb.org/3'
> API_KEY = 'ddf3xxxxxxxx0289'
>
>
> class Actor(Document):
>     pass
>
>
> def get_actor(_id):
>     r = requests.get('{}/person/{}?api_key={}'.format(API_URL, str(_id),
> API_KEY))
>     return r.json()
>
>
> actor_1 = Actor(get_actor(1))
> actor_2 = Actor(get_actor(2))
>
> backend = FileBackend("db.blitz")
> actor_1.save(backend)
> actor_2.save(backend)
>
> print(backend.get(Actor,{'imdb_id' : 'nm0000184'}))
> print('\n')
> print(backend.get(Actor,{'imdb_id' : 'nm0000434'}))
>
>
> OUTPUT ---------------------
>
> Warning: cjson could not be imported, CJsonSerializer will not be
> available.
> Traceback (most recent call last):
>   File ".\uff.py", line 27, in <module>
>     print(backend.get(Actor,{'imdb_id' : 'nm0000184'}))
>   File "C:\Python34\lib\site-packages\blitzdb\backends\file\backend.py",
> line 456, in get
>     raise cls.DoesNotExist
> blitzdb.document.DoesNotExist: DoesNotExist(Actor)
>
>
> QUESTION ---------------------
>
> Why the output says that Actor doesn't exists when I already added it here
> 'actor_1.save(backend)' and 'actor_2.save(backend)'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141022/cdd18ad6/attachment.html>


More information about the Python-list mailing list