Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78204
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'attribute': 0.07; 'class,': 0.07; 'method,': 0.09; 'pil': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'try:': 0.09; "chris'": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sad': 0.16; 'subject:PIL': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'module,': 0.24; 'received:comcast.net': 0.24; 'this:': 0.26; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'code': 0.31; 'class': 0.32; 'except': 0.35; 'but': 0.35; "i'll": 0.36; 'should': 0.36; 'list.': 0.37; 'to:addr:python-list': 0.38; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; "you've": 0.63; 'show': 0.63; 'name': 0.63; 'frank': 0.68; '4:29': 0.84; 'skip:s 80': 0.84; 'subject:read': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ned Batchelder <ned@nedbatchelder.com> |
| Subject | Re: PIL can't read binary |
| Date | Tue, 23 Sep 2014 07:03:58 -0400 |
| References | <2bae5b6f-a3b9-40d8-a037-a6ff309ba71f@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | c-50-133-228-126.hsd1.ma.comcast.net |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <2bae5b6f-a3b9-40d8-a037-a6ff309ba71f@googlegroups.com> |
| 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.14255.1411470254.18130.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1411470254 news.xs4all.nl 2939 [2001:888:2000:d::a6]:45121 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:78204 |
Show key headers only | View raw
On 9/23/14 4:29 AM, Frank Liou wrote:
> I use PIL Image.open()
>
> but it show 'list' object has no attribute 'open'
>
> this is my code
>
> class Image2():
> trans = connection.begin()
> session = Session()
> ProductId = session.query(ProductEntity.ProductId).filter(ProductEntity.CompanyId=="2").all()
> Image = session.query(ProductImageGalleryEntity).filter(ProductImageGalleryEntity.ProductId=="20").all()
> PicFromDataBase = Image[0].ProductImage
> try:
> b = Image.open(str(PicFromDataBase))
> except Exception as e:
> sad = e
Image is the name of the PIL module, but you've reassigned it to be a
list. Try this:
images =
session.query(ProductImageGalleryEntity).filter(ProductImageGalleryEntity.ProductId=="20").all()
PicFromDataBase = images[0].ProductImage
try:
b = Image.open(str(PicFromDataBase))
except Exception as e:
sad = e
Also, I'll second Chris' point that this code should not be in the body
of the class, but in a method, or perhaps just a plain-old function.
--
Ned Batchelder, http://nedbatchelder.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
PIL can't read binary Frank Liou <fk26541598fk@gmail.com> - 2014-09-23 01:29 -0700 Re: PIL can't read binary Chris Angelico <rosuav@gmail.com> - 2014-09-23 18:36 +1000 Re: PIL can't read binary Ned Batchelder <ned@nedbatchelder.com> - 2014-09-23 07:03 -0400
csiph-web