Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 28th, 2004, 09:28 PM
duniyadnd duniyadnd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 30 duniyadnd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 44 m 4 sec
Reputation Power: 0
Image class not finding image on a website

I'm trying a simple image initialization... but alas alack and stuff...


Code:
'''imports'''

##! /usr/local/bin/python
import sys, Image, urllib

image = 'http://www.footymania.com/images/banners/bannerdan.png'

im = Image.open(image)


I get the following error message

File (location of file\Image.py), Line 1543, in open
fp = __builtin__.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'http://www.footymania.com/images/banners/bannerdan.png'

This happens for all types of images online even though i know they exist. I tested it out with the google logos as well, and the same error takes place.

Reply With Quote
  #2  
Old April 29th, 2004, 01:45 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
The problem your getting is that your trying to pass a URL to Image.open when it wants a local path.

If you really want to load an image from online then you will probably need to use urllib.urlopen() to get the image as a string (or write it to a file) and then load the image into PIL from the string (or file).

Hope this helps clear things up,

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old April 29th, 2004, 08:27 AM
duniyadnd duniyadnd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 30 duniyadnd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 44 m 4 sec
Reputation Power: 0
AAaaaaaaaah... makes sense.. bummer though, cause I know you can do that with the php image library.

Reply With Quote
  #4  
Old April 30th, 2004, 03:12 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Ah but then PHP was designed spacifically for the web so it makes sence that you can use URL's as paths in some functions where Pythons design is alot more general perpose yet infinatly nicer IMO.

Mark.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Image class not finding image on a website

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap