Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79457

Re: Python 3.4.1 and blitzdb issue

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 <juan0christian@gmail.com>
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&gt;': 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 <CAAp0bGu4hKfNyz6mm+-FUgkTJXozmu7afp_4uzwGjowEJOakeA@mail.gmail.com>
References <CAAp0bGu4hKfNyz6mm+-FUgkTJXozmu7afp_4uzwGjowEJOakeA@mail.gmail.com>
From Juan Christian <juan0christian@gmail.com>
Date Wed, 22 Oct 2014 14:38:12 -0200
Subject Re: Python 3.4.1 and blitzdb issue
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15082.1413995920.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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@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)'
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python 3.4.1 and blitzdb issue Juan Christian <juan0christian@gmail.com> - 2014-10-22 14:38 -0200

csiph-web