I was trying to upload capt.png, but I typed capt.py
instead. This is what happened:
File or URL where image is now : capt.py
Traceback (most recent call last):
File "C:\pywikipediabot\upload.py", line 57, in ?
lib_images.get_image(fn, None, desc, keep)
File "C:\pywikipediabot\lib_images.py", line 135, in
get_image
file = uo.open(fn)
File "C:\Python23\lib\urllib.py", line 181, in open
return getattr(self, name)(url)
File "C:\Python23\lib\urllib.py", line 410, in open_file
return self.open_local_file(url)
File "C:\Python23\lib\urllib.py", line 420, in
open_local_file
raise IOError(e.errno, e.strerror, e.filename)
IOError: [Errno 2] No such file or directory: 'capt.py'
It should just check for the file and repeat the "File
or URL where image is now :" prompt if it doesn't exist.
Logged In: YES
user_id=880694
Nearly impossible to fix because the filename is read in
upload.py, but the file is opened in lib_images.py.
So you need to open the file in upload.py and close it again
just to check if the file exists. But the filename can also
be a URL, so this won't work.
Logged In: YES
user_id=47476
Something can be done about it by checking whether either fn
exists as a file, or it looks like a url (there is :// in
there). Existing as a file can be checked by
os.path.exists(). I just checked this in with very limited
testing