Mar-12-2017, 09:13 PM
I was watching the Buckys tutorial about how to download the image from internet and i copied all he said but my program did not work.
Im new to this forum.How can i send an image from my pc?
Quote:How can i send an image from my pc?
import random import urllib.request def download_web_image(url): name=random.randrange(1,1000) fullname=str(name)+".jpg" urllib.request.urlretrieve(url,fullname) download_web_image(http://www.reef2reef.com/data/ams/431/431079-8956905e1ef117b2e057a39686ede6a4.jpg)
import random import urllib.request def download_web_image(url): name=random.randrange(1,1000) fullname=str(name)+".jpg" urllib.request.urlretrieve(url,fullname) download_web_image(http://www.reef2reef.com/data/ams/431/431079-8956905e1ef117b2e057a39686ede6a4.jpg)
(Mar-12-2017, 09:21 PM)metulburr Wrote: [ -> ]1) What is the code you are using? Post in python code tags here on the forum
2) How big is the file you are downloading?
3) What is the link to the youtube tutorial you are using?
4) When you say "it did not work" What happened? What was the error?
5) Do you need to login to see the file, or can the public access it?
Quote:How can i send an image from my pc?
6) send an image to where?
7) Im switching this to general coding because you should have put your code you are using
Error:C:\Python27\python.exe C:/Users/arman/PycharmProjects/untitled1/asddf.py
File "C:/Users/arman/PycharmProjects/untitled1/asddf.py", line 8
download_web_image(http://www.reef2reef.com/data/ams/431/431079-8956905e1ef117b2e057a39686ede6a4.jpg)
^
SyntaxError: invalid syntax
Process finished with exit code 1
import random import urllib.request def download_web_image(url): name=random.randrange(1,1000) fullname=str(name)+".jpg" urllib.request.urlretrieve(url,fullname) download_web_image("http://www.reef2reef.com/data/ams/431/431079-8956905e1ef117b2e057a39686ede6a4.jpg")
>>> import uuid >>> file_id = uuid.uuid4() >>> file_id UUID('08830c82-48a7-453d-9a83-cd5fca522712') >>> name = file_id.int >>> name 11314268565808898375662089066352092946
(Mar-12-2017, 09:44 PM)zivoni Wrote: [ -> ]url of image passed to your download_web_image function should be enclosed in quotes:oh yes that was the problem.
Error:C:\Python27\python.exe C:/Users/arman/PycharmProjects/untitled1/asddf.py
Traceback (most recent call last):
File "C:/Users/arman/PycharmProjects/untitled1/asddf.py", line 2, in <module>
import urllib.request
ImportError: No module named request
Process finished with exit code 1
(Mar-12-2017, 09:48 PM)wavic Wrote: [ -> ]Well, your function returns nothing. If that is your full code.It has to save a simple pictur.Im just learning web programming.