Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download fails for file "C'est là le moulin?.JPG" #8

Open
edouardhue opened this issue Oct 2, 2014 · 2 comments
Open

Download fails for file "C'est là le moulin?.JPG" #8

edouardhue opened this issue Oct 2, 2014 · 2 comments
Labels

Comments

@edouardhue
Copy link
Member

Log is:

INFO:root:Downloading C'est_l+á_le_moulin?.JPG with width 99999
INFO:root:Requested width is bigger than source - downloading full size
Traceback (most recent call last):
  File "C:\Python27\Scripts\download_from_Wikimedia_Commons-script.py", line 9, in <module>
    load_entry_point('CommonsDownloader==0.2', 'console_scripts', 'download_from_Wikimedia_Commons')()
  File "build\bdist.win32\egg\commonsdownloader\commonsdownloader.py", line 85, in main
  File "build\bdist.win32\egg\commonsdownloader\commonsdownloader.py", line 27, in download_from_file_list
  File "build\bdist.win32\egg\commonsdownloader\thumbnaildownload.py", line 122, in download_file
IOError: [Errno 22] invalid mode ('wb') or filename: ".\\Pictures\\C'est_l\xc3\xa0_le_moulin?.jpg"

Running @symac's patched version with Python 2.7.8 in PowerShell in Windows 8.1 Pro N. Issue seems to be caused by NTFS / Windows not supporting "?" in filenames.

JeanFred added a commit that referenced this issue Jan 17, 2015
If the file cannot be written on disk, raising an IOError,
then we log it as error and raise a DownloadException to
be handled be the caller.

Add new Exception CouldNotWriteFileOnDiskException.

Addresses #8.
@JeanFred
Copy link
Member

With the proper exception handling introduced in 7dad7e6 and 3e1c728, the severity of this is mitigated since 1. CommonsDownloader will no longer crash when such a problem occurs 2/ The incident will be logged and notified to the user.

@JeanFred
Copy link
Member

Digging more, I have not unearthed any obvious way to filter Windows forbidden characters in Python. Sounds like such a thing should exist though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants