Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.058 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'output': 0.05; 'subject:Python': 0.06; 'skip:" 60': 0.07; '22,': 0.09; 'skip:\\ 10': 0.09; 'skip:f 70': 0.09; 'u.s.c.': 0.09; 'api': 0.11; 'def': 0.12; 'cjson': 0.16; 'jr.': 0.16; 'skip:u 70': 0.16; 'skip:{ 30': 0.16; 'subject:issue': 0.16; 'which,': 0.16; 'student': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'backend': 0.19; 'later': 0.20; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'exists': 0.24; 'skip:l 30': 0.24; 'question': 0.24; 'pass': 0.26; 'code:': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; 'feature': 0.29; 'skip:p 30': 0.29; 'raise': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'requests': 0.31; "skip:' 10": 0.31; 'continually': 0.31; 'era': 0.31; 'george': 0.31; 'skip:& 70': 0.31; 'file': 0.32; 'class': 0.32; 'says': 0.33; '(most': 0.33; 'skip:# 10': 0.33; 'skip:b 30': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'url:org': 0.36; 'skip:- 20': 0.37; 'christian': 0.38; 'skip:& 10': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'days': 0.60; 'skip:l 50': 0.60; 'most': 0.60; 'new': 0.61; 'url:3': 0.61; 'success': 0.61; 'first': 0.61; 'here': 0.66; 'bulk': 0.74; 'expectations': 0.74; 'film': 0.74; 'day': 0.76; 'low': 0.83; 'blast': 0.84; 'blockbuster': 0.84; 'climate': 0.84; 'executives,': 0.84; 'hollywood': 0.84; 'mentality': 0.84; 'popularity': 0.84; 'prevailing': 0.84; 'studios': 0.84; 'tone': 0.84; 'spectacular': 0.91; 'lucas': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=HWnQPb5XCTKX+5keDYrtQQ/6PXcC7ZhM1FyY0yQj+Ag=; b=X3GcuXckpUPTyDBPZ95tF2pFjaf/Xhub0D0X6nHLaSpaeCYypTs8Vzans4458ITb8Z Mc0/DuiEMN6Wx7wXxIvZ+JqS1eW7941yoNZP7wJgF/vQxTs5cyz3LZZiBWjEzgY2jp73 +ic8out9lHkZiACPlWwKGzbOyYSEiMTR+y2RLk/qnEkNjs+/Xy+UyStikHQrCxRVSfQG DKrUlBO9pvX63Bt+Eui74o7+nW0HOcNwSC5kxRk4JKvjZyJGN54Q3vbjxm6JavLYJhZF Qzw1Tm0k0W8LKHj/YLBzzaNLG1sYAEJQOwKJSk7Ad3AsJrAQzOmpIQ0QN2k4iGNceAX7 folw== X-Received: by 10.112.93.231 with SMTP id cx7mr11487164lbb.89.1413995913182; Wed, 22 Oct 2014 09:38:33 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Juan Christian Date: Wed, 22 Oct 2014 14:38:12 -0200 Subject: Re: Python 3.4.1 and blitzdb issue To: Python Content-Type: multipart/alternative; boundary=001a11348be81e8603050605941a X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 145 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413995920 news.xs4all.nl 2888 [2001:888:2000:d::a6]:55566 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 11297 X-Received-Body-CRC: 2566959768 Xref: csiph.com comp.lang.python:79457 --001a11348be81e8603050605941a Content-Type: text/plain; charset=UTF-8 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 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 > 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)' > --001a11348be81e8603050605941a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Oh yes, and here is what the call to the API returns:
=
{"adult":false,"also_known_as":["George Walt= on Lucas Jr. "],"biography":"Arguably the most importan= t film innovator in the history of the medium, George Lucas continually \&q= uot;pushed the envelope\" of filmmaking technology since his early day= s 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 e= fforts in some way. The monumental success of \"Star Wars\" (1977= ) ushered in the era of the \"summer blockbuster,\" which, despit= e the later popularity of low budget independent films, was still the preva= iling mentality powering the Hollywood engine.\n\nThough he set the tone an= d established the expectations which influenced studios to devote the bulk = of their resources to films designed to blast off into hyperspace for spect= acular profits, it was doubtful that a film as revolutionary as \"Star= Wars\" was in its day could get made in the later blockbuster assembl= y line climate of the new millennium.","birthday":"1944= -05-14","deathday":"","homepage":"&= quot;,"id":1,"imdb_id":"nm0000184","name= ":"George Lucas","place_of_birth":"Modesto - = California - USA","popularity":2.185575,"profile_path&q= uot;:"/rJ1zvSeZfge0mHtLnzJn4Mkw18S.jpg"}<= /td>

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

CODE=C2=A0-= --------------------

#!/usr/bin/env

<= /div>
import requests
from blitzdb import Document, FileBacke= nd


API_URL =3D 'http://api.themoviedb.org/3&= #39;
API_KEY =3D 'ddf3xxxxxxxx0289'

<= div>
class Actor(Document):
=C2=A0 =C2=A0 pass


def get_actor(_id):
=C2=A0 = =C2=A0 r =3D requests.get('{}/person/{}?api_key=3D{}'.format(API_UR= L, str(_id), API_KEY))
=C2=A0 =C2=A0 return r.json()

actor_1 =3D Actor(get_actor(1))
actor= _2 =3D Actor(get_actor(2))

backend =3D FileBackend= ("db.blitz")
actor_1.save(backend)
actor_2.sa= ve(backend)

print(backend.get(Actor,{'imdb_id&= #39; : 'nm0000184'}))
print('\n')
print= (backend.get(Actor,{'imdb_id' : 'nm0000434'}))
<= div>

OUTPUT ---------------------
Warning: cjson could not be imported, CJsonSerializer wil= l not be available.
Traceback (most recent call last):
= =C2=A0 File ".\uff.py", line 27, in <module>
=C2= =A0 =C2=A0 print(backend.get(Actor,{'imdb_id' : 'nm0000184'= }))
=C2=A0 File "C:\Python34\lib\site-packages\blitzdb\backe= nds\file\backend.py", line 456, in get
=C2=A0 =C2=A0 raise c= ls.DoesNotExist
blitzdb.document.DoesNotExist: DoesNotExist(Actor= )


QUESTION ------------------= ---

Why the output says that Actor doesn't exi= sts when I already added it here 'actor_1.save(backend)' and 'a= ctor_2.save(backend)'

--001a11348be81e8603050605941a--