I have a really irritating problem.
I'm using Python to open a URL link which is a pdf file and i want to save it in my local folder.
My code :
urlPath = 'http://example.com/test.pdf'
myFile = urlopen(urlPath)
urllib.urlretrieve(myFile.url, myFile.url)
Error message:
tfp = open(filename, 'wb')
IOError: [Errno 22] invalid mode ('wb') or filename:
I have tried to use to code below and everythin works fine, my file stored correctly.
urlPath = 'http://example.com/test.pdf'
myFile = urlopen(urlPath)
urllib.urlretrieve(myFile.url, 'myFile.pdf')
What does i'm writing wrong?