Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79460 > unrolled thread
| Started by | "Stéphane Wirtel" <stephane@wirtel.be> |
|---|---|
| First post | 2014-10-22 18:45 +0200 |
| Last post | 2014-10-22 18:45 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Python 3.4.1 and blitzdb issue "Stéphane Wirtel" <stephane@wirtel.be> - 2014-10-22 18:45 +0200
| From | "Stéphane Wirtel" <stephane@wirtel.be> |
|---|---|
| Date | 2014-10-22 18:45 +0200 |
| Subject | Re: Python 3.4.1 and blitzdb issue |
| Message-ID | <mailman.15085.1413996856.18130.python-list@python.org> |
Maybe ask on the project on github. Andreas is a good guy and will reply
asap.
On 22 Oct 2014, at 18:34, 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 <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)'
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Stéphane Wirtel - http://wirtel.be - @matrixise
Back to top | Article view | comp.lang.python
csiph-web