mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1303181 [ebook-device cp -f gives exits with error when trying to copy to kindle](https://bugs.launchpad.net/calibre/+bug/1303181)
This commit is contained in:
parent
b12b60da40
commit
16891b7f47
@ -10,7 +10,6 @@ import StringIO, sys, time, os
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from calibre import __version__, __appname__, human_readable, fsync
|
from calibre import __version__, __appname__, human_readable, fsync
|
||||||
from calibre.devices.errors import PathError
|
|
||||||
from calibre.devices.errors import ArgumentError, DeviceError, DeviceLocked
|
from calibre.devices.errors import ArgumentError, DeviceError, DeviceLocked
|
||||||
from calibre.customize.ui import device_plugins
|
from calibre.customize.ui import device_plugins
|
||||||
from calibre.devices.scanner import DeviceScanner
|
from calibre.devices.scanner import DeviceScanner
|
||||||
@ -319,14 +318,7 @@ def main():
|
|||||||
print >> sys.stderr, e
|
print >> sys.stderr, e
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
return 1
|
return 1
|
||||||
try:
|
dev.put_file(infile, args[1][4:], replace_file=options.force)
|
||||||
dev.put_file(infile, args[1][4:])
|
|
||||||
except PathError as err:
|
|
||||||
if options.force and 'exists' in str(err):
|
|
||||||
dev.del_file(err.path, False)
|
|
||||||
dev.put_file(infile, args[1][4:])
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
infile.close()
|
infile.close()
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user